Re: vmwgfx + VMWare 7.0 - libdrm modetest.c

2010-02-10 Thread Peter Hanzel

Hello.

I don't have a patch, as I can't still make it run on VMWare.
But tests on other graphic card can be good.
I have attached the file.

There is no Cairo code, no page_flip and
I have also added drmModeDirtyFB, as Jakob from vmware suggested to make it 
work under vmwgfx.


Regards.

- Original Message - 
From: Kristian Høgsberg k...@bitplanet.net

To: Peter Hanzel hanzelpe...@gmail.com
Cc: dri-devel@lists.sourceforge.net
Sent: Tuesday, February 09, 2010 3:14 PM
Subject: Re: vmwgfx + VMWare 7.0 - libdrm modetest.c


On Tue, Feb 9, 2010 at 8:05 AM, Peter Hanzel hanzelpe...@gmail.com 
wrote:

Hello.

I have a question about libdrm/libkms and test/modetest/modetest.c.
I am now working with vmwgfx + VMWare 7.0, where vmwgfx had correctly
initialized framebuffer and also now using fbcon.
Now I want to test it woth modetest.c
This program is only for intel so i recoded it to use libkms functions.


Could you send the changes to make modetest.c use libkms as a patch?
It's a good idea.

cheers,
Kristian


/*
* DRM based mode setting test program
* Copyright 2008 Tungsten Graphics
*   Jakob Bornecrantz ja...@tungstengraphics.com
* Copyright 2008 Intel Corporation
*   Jesse Barnes jesse.bar...@intel.com
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the Software),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/

/*
* This fairly simple test program dumps output in a similar format to the
* xrandr tool everyone knows  loves.  It's necessarily slightly different
* since the kernel separates outputs into encoder and connector structures,
* each with their own unique ID.  The program also allows test testing of the
* memory management and mode setting APIs by allowing the user to specify a
* connector and mode to use for mode setting.  If all works as expected, a
* blue background should be painted on the monitor attached to the specified
* connector after the selected mode is set.
*
* TODO: use cairo to write the mode info on the selected output once
*   the mode has been programmed, along with possible test patterns.
*/
#include config.h

#include assert.h
#include stdio.h
#include stdlib.h
#include stdint.h
#include unistd.h
#include string.h
#include errno.h
#include sys/poll.h

#include xf86drm.h
#include xf86drmMode.h
#include libkms/libkms.h

struct kms_bo
{
   struct kms_driver *kms;
   void *ptr;
   size_t size;
   size_t offset;
   size_t pitch;
   unsigned handle;
};


drmModeRes *resources;
int fd, modes;

#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))

struct type_name {
int type;
char *name;
};

#define type_name_fn(res) \
char * res##_str(int type) {\
int i;  \
for (i = 0; i  ARRAY_SIZE(res##_names); i++) { \
if (res##_names[i].type == type)\
return res##_names[i].name; \
}   \
return (invalid);   \
}

struct type_name encoder_type_names[] = {
{ DRM_MODE_ENCODER_NONE, none },
{ DRM_MODE_ENCODER_DAC, DAC },
{ DRM_MODE_ENCODER_TMDS, TMDS },
{ DRM_MODE_ENCODER_LVDS, LVDS },
{ DRM_MODE_ENCODER_TVDAC, TVDAC },
};

type_name_fn(encoder_type)

struct type_name connector_status_names[] = {
{ DRM_MODE_CONNECTED, connected },
{ DRM_MODE_DISCONNECTED, disconnected },
{ DRM_MODE_UNKNOWNCONNECTION, unknown },
};

type_name_fn(connector_status)

struct type_name connector_type_names[] = {
{ DRM_MODE_CONNECTOR_Unknown, unknown },
{ DRM_MODE_CONNECTOR_VGA, VGA },
{ DRM_MODE_CONNECTOR_DVII, DVI-I },
{ DRM_MODE_CONNECTOR_DVID, DVI-D },
{ DRM_MODE_CONNECTOR_DVIA, DVI-A },
{ DRM_MODE_CONNECTOR_Composite, composite },
{ DRM_MODE_CONNECTOR_SVIDEO, s-video },
{ DRM_MODE_CONNECTOR_LVDS, LVDS },
{ DRM_MODE_CONNECTOR_Component, component },
{ DRM_MODE_CONNECTOR_9PinDIN, 9-pin DIN

vmwgfx + VMWare 7.0 - libdrm modetest.c

2010-02-09 Thread Peter Hanzel
Hello.

I have a question about libdrm/libkms and test/modetest/modetest.c.
I am now working with vmwgfx + VMWare 7.0, where vmwgfx had correctly 
initialized framebuffer and also now using fbcon.
Now I want to test it woth modetest.c
This program is only for intel so i recoded it to use libkms functions.

I had to add:

struct kms_bo
{
 struct kms_driver *kms;
 void *ptr;
 size_t size;
 size_t offset;
 size_t pitch;
 unsigned handle;
};

to modetest.c to compile it.

Now the test can set mode. I have tested 800x600 and also 1024x768.
But my problem is that screen is always black. If you take a look into 
modetest.c it is making that nice one tilled colour screen.

The problem lines are in:

libkms/vmwgfx.c

static int
vmwgfx_bo_create(struct kms_driver *kms,
   const unsigned width, const unsigned height,
   const enum kms_bo_type type, const unsigned *attr,
   struct kms_bo **out)
{

do {
   ret = drmCommandWriteRead(bo-base.kms-fd,
DRM_VMW_ALLOC_DMABUF,
arg, sizeof(arg));
  } while (ret == -ERESTART);

  if (ret)
   goto err_free;

  bo-base.handle = rep-handle;
  bo-map_handle = rep-map_handle;
  bo-base.handle = rep-cur_gmr_id;
  bo-base.offset = rep-cur_gmr_offset;

As you can see, there is:
  bo-base.handle = rep-handle;
  bo-base.handle = rep-cur_gmr_id;

So it is overwiting the same base.handle.

This handle I am using in modetest.c - drmModeAddFB().   maybe here is 
error,
bo-base.handle is not the correct one for use in drmModeAddFB( 
bo-handle)

So my question is:
 1) The need of define for strcut kms_bo (is is located in 
libkms/internal.h)
 2) Why the screen is still black?

Thanks.




--
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
--
___
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel


Re: vmwgfx + VMWare 7.0 - libdrm modetest.c

2010-02-09 Thread Jakob Bornecrantz
On 9 feb 2010, at 13.05, Peter Hanzel wrote:
 Hello.

 I have a question about libdrm/libkms and test/modetest/modetest.c.
 I am now working with vmwgfx + VMWare 7.0, where vmwgfx had correctly
 initialized framebuffer and also now using fbcon.
 Now I want to test it woth modetest.c
 This program is only for intel so i recoded it to use libkms  
 functions.

 I had to add:

 struct kms_bo
 {
 struct kms_driver *kms;
 void *ptr;
 size_t size;
 size_t offset;
 size_t pitch;
 unsigned handle;
 };

 to modetest.c to compile it.

 Now the test can set mode. I have tested 800x600 and also 1024x768.
 But my problem is that screen is always black. If you take a look into
 modetest.c it is making that nice one tilled colour screen.

 The problem lines are in:

 libkms/vmwgfx.c

 static int
 vmwgfx_bo_create(struct kms_driver *kms,
   const unsigned width, const unsigned height,
   const enum kms_bo_type type, const unsigned *attr,
   struct kms_bo **out)
 {
 
 do {
   ret = drmCommandWriteRead(bo-base.kms-fd,
DRM_VMW_ALLOC_DMABUF,
arg, sizeof(arg));
  } while (ret == -ERESTART);

  if (ret)
   goto err_free;

  bo-base.handle = rep-handle;
  bo-map_handle = rep-map_handle;
  bo-base.handle = rep-cur_gmr_id;
  bo-base.offset = rep-cur_gmr_offset;

 As you can see, there is:
  bo-base.handle = rep-handle;
  bo-base.handle = rep-cur_gmr_id;

 So it is overwiting the same base.handle.

 This handle I am using in modetest.c - drmModeAddFB().   maybe  
 here is
 error,
bo-base.handle is not the correct one for use in drmModeAddFB(
 bo-handle)

 So my question is:
 1) The need of define for strcut kms_bo (is is located in
 libkms/internal.h)

struct kms_bo is a internal resource to the libkms interface, it  
should be opaque to the user but to the internal code. All the buffer  
exposes pretty much the same set of information to the user but might  
need extra information attached. Defining a base kms_bo object that  
backends can use as a baseclass allows code to be shared.

 2) Why the screen is still black?

You need to use the drmModeDirtyFB ioctl/function to tell the Kernel  
to update the screen. Just call it like so drmModeDirtyFB(fd, fb,  
NULL, 0); and it should update the whole screen.

Cheers Jakob.

--
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
--
___
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel


Re: vmwgfx + VMWare 7.0 - libdrm modetest.c

2010-02-09 Thread Kristian Høgsberg
On Tue, Feb 9, 2010 at 8:05 AM, Peter Hanzel hanzelpe...@gmail.com wrote:
 Hello.

 I have a question about libdrm/libkms and test/modetest/modetest.c.
 I am now working with vmwgfx + VMWare 7.0, where vmwgfx had correctly
 initialized framebuffer and also now using fbcon.
 Now I want to test it woth modetest.c
 This program is only for intel so i recoded it to use libkms functions.

Could you send the changes to make modetest.c use libkms as a patch?
It's a good idea.

cheers,
Kristian

--
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
--
___
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel