Re: [Mesa-dev] [PATCH] vl/dri3: handle the case of different GPU(v4.1)

2016-09-30 Thread Nayan Deshmukh
Hi Axel,
On 1 Oct 2016 02:34, "Axel Davy"  wrote:
>
> On 16/09/2016 14:51, Nayan Deshmukh wrote:
>>
>>
>> bool flushed;
>> +   bool is_different_gpu;
>>  };
>>
>
> I get a warning when I build about incompatible pointer type at the line
>
> fd = loader_get_user_preferred_fd(fd, &scrn->is_different_gpu);
>
> When compiling on 32 bits.
>
> I get this should be int.
>
Yes you are right it should be int. I will submit a patch later today.

Regards,
Nayan
>
> Axel
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] vl/dri3: handle the case of different GPU(v4.1)

2016-09-30 Thread Axel Davy

On 16/09/2016 14:51, Nayan Deshmukh wrote:
  
 bool flushed;

+   bool is_different_gpu;
  };
  


I get a warning when I build about incompatible pointer type at the line

fd = loader_get_user_preferred_fd(fd, &scrn->is_different_gpu);

When compiling on 32 bits.

I get this should be int.


Axel

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] vl/dri3: handle the case of different GPU(v4.1)

2016-09-19 Thread Nayan Deshmukh
Hi Leo,



On Tue, Sep 20, 2016 at 1:56 AM, Leo Liu  wrote:

>
>
> On 09/17/2016 07:33 AM, Nayan Deshmukh wrote:
>
> Hi Leo,
>
> Could you push the patches? I don't have the push access.
>
>
>
> Can you rebase all your reviewed patches, and add RB to it, and then you
> can send them to me ?
>
> Surely. :)

I will also include changes suggested by emil.

> Sorry for too busy to do this for you.
>
> Regards,
> Leo
>
>
>
> Regards,
> Nayan.
>
> On Fri, Sep 16, 2016 at 7:44 PM, Leo Liu  wrote:
>
>> This Patch is Reviewed-by: Leo Liu 
>>
>>
>> On 09/16/2016 08:51 AM, Nayan Deshmukh wrote:
>>
>>> In case of prime when rendering is done on GPU other then the
>>> server GPU, use a seprate linear buffer for each back buffer
>>> which will be displayed using present extension.
>>>
>>> v2: Use a seprate linear buffer for each back buffer (Michel)
>>> v3: Change variable names and fix coding style (Leo and Emil)
>>> v4: Use PIPE_BIND_SAMPLER_VIEW for back buffer in case when
>>>  a seprate linear buffer is used (Michel)
>>> v4.1: remove empty line
>>>
>>> Signed-off-by: Nayan Deshmukh < 
>>> nayan26deshm...@gmail.com>
>>> ---
>>>   src/gallium/auxiliary/vl/vl_winsys_dri3.c | 61
>>> ---
>>>   1 file changed, 48 insertions(+), 13 deletions(-)
>>>
>>> diff --git a/src/gallium/auxiliary/vl/vl_winsys_dri3.c
>>> b/src/gallium/auxiliary/vl/vl_winsys_dri3.c
>>> index 3d596a6..e0aaad8 100644
>>> --- a/src/gallium/auxiliary/vl/vl_winsys_dri3.c
>>> +++ b/src/gallium/auxiliary/vl/vl_winsys_dri3.c
>>> @@ -49,6 +49,7 @@
>>>   struct vl_dri3_buffer
>>>   {
>>>  struct pipe_resource *texture;
>>> +   struct pipe_resource *linear_texture;
>>>uint32_t pixmap;
>>>  uint32_t sync_fence;
>>> @@ -69,6 +70,8 @@ struct vl_dri3_screen
>>>  xcb_present_event_t eid;
>>>  xcb_special_event_t *special_event;
>>>   +   struct pipe_context *pipe;
>>> +
>>>  struct vl_dri3_buffer *back_buffers[BACK_BUFFER_NUM];
>>>  int cur_back;
>>>   @@ -82,6 +85,7 @@ struct vl_dri3_screen
>>>  int64_t last_ust, ns_frame, last_msc, next_msc;
>>>bool flushed;
>>> +   bool is_different_gpu;
>>>   };
>>> static void
>>> @@ -102,6 +106,8 @@ dri3_free_back_buffer(struct vl_dri3_screen *scrn,
>>>  xcb_sync_destroy_fence(scrn->conn, buffer->sync_fence);
>>>  xshmfence_unmap_shm(buffer->shm_fence);
>>>  pipe_resource_reference(&buffer->texture, NULL);
>>> +   if (buffer->linear_texture)
>>> +   pipe_resource_reference(&buffer->linear_texture, NULL);
>>>  FREE(buffer);
>>>   }
>>>   @@ -209,7 +215,7 @@ dri3_alloc_back_buffer(struct vl_dri3_screen *scrn)
>>>  xcb_sync_fence_t sync_fence;
>>>  struct xshmfence *shm_fence;
>>>  int buffer_fd, fence_fd;
>>> -   struct pipe_resource templ;
>>> +   struct pipe_resource templ, *pixmap_buffer_texture;
>>>  struct winsys_handle whandle;
>>>  unsigned usage;
>>>   @@ -226,8 +232,7 @@ dri3_alloc_back_buffer(struct vl_dri3_screen *scrn)
>>> goto close_fd;
>>>memset(&templ, 0, sizeof(templ));
>>> -   templ.bind = PIPE_BIND_RENDER_TARGET | PIPE_BIND_SAMPLER_VIEW |
>>> -PIPE_BIND_SCANOUT | PIPE_BIND_SHARED;
>>> +   templ.bind = PIPE_BIND_RENDER_TARGET | PIPE_BIND_SAMPLER_VIEW;
>>>  templ.format = PIPE_FORMAT_B8G8R8X8_UNORM;
>>>  templ.target = PIPE_TEXTURE_2D;
>>>  templ.last_level = 0;
>>> @@ -235,16 +240,34 @@ dri3_alloc_back_buffer(struct vl_dri3_screen *scrn)
>>>  templ.height0 = scrn->height;
>>>  templ.depth0 = 1;
>>>  templ.array_size = 1;
>>> -   buffer->texture = scrn->base.pscreen->resource_c
>>> reate(scrn->base.pscreen,
>>> - &templ);
>>> -   if (!buffer->texture)
>>> -  goto unmap_shm;
>>>   +   if (scrn->is_different_gpu) {
>>> +  buffer->texture = scrn->base.pscreen->resource_c
>>> reate(scrn->base.pscreen,
>>> +&templ);
>>> +  if (!buffer->texture)
>>> + goto unmap_shm;
>>> +
>>> +  templ.bind |= PIPE_BIND_SCANOUT | PIPE_BIND_SHARED |
>>> +PIPE_BIND_LINEAR;
>>> +  buffer->linear_texture = scrn->base.pscreen->resource_c
>>> reate(scrn->base.pscreen,
>>> +
>>> &templ);
>>> +  pixmap_buffer_texture = buffer->linear_texture;
>>> +
>>> +  if (!buffer->linear_texture)
>>> + goto no_linear_texture;
>>> +   } else {
>>> +  templ.bind |= PIPE_BIND_SCANOUT | PIPE_BIND_SHARED;
>>> +  buffer->texture = scrn->base.pscreen->resource_c
>>> reate(scrn->base.pscreen,
>>> +&templ);
>>> +  if (!buffer->texture)
>>> + goto unmap_shm;
>>> +  pixmap_buffer_texture = buffer->texture;
>>> +   }
>>>  memset(&whandle, 0, sizeof(whandle));
>>>  whandle.type= DRM_API_HANDLE_TYPE_FD;
>>>  usage = PIPE_HANDLE_USAGE_EXPLICIT_FLUSH | PIPE_HANDLE_USAGE_READ;
>>>  scrn->base.pscreen->resource_get_handle(scrn

Re: [Mesa-dev] [PATCH] vl/dri3: handle the case of different GPU(v4.1)

2016-09-19 Thread Emil Velikov
Hi Nayan,

On 16 September 2016 at 13:51, Nayan Deshmukh  wrote:

> +   scrn->pipe = scrn->base.pscreen->context_create(scrn->base.pscreen,
> +   &scrn->base, 0);
> +
I think you're forgetting to destroy the context in
vl_dri3_screen_destroy and proper handling if context_create fails
seems to be missing.

-Emil
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] vl/dri3: handle the case of different GPU(v4.1)

2016-09-19 Thread Leo Liu



On 09/17/2016 07:33 AM, Nayan Deshmukh wrote:

Hi Leo,

Could you push the patches? I don't have the push access.



Can you rebase all your reviewed patches, and add RB to it, and then you 
can send them to me ?


Sorry for too busy to do this for you.

Regards,
Leo



Regards,
Nayan.

On Fri, Sep 16, 2016 at 7:44 PM, Leo Liu > wrote:


This Patch is Reviewed-by: Leo Liu mailto:leo@amd.com>>


On 09/16/2016 08:51 AM, Nayan Deshmukh wrote:

In case of prime when rendering is done on GPU other then the
server GPU, use a seprate linear buffer for each back buffer
which will be displayed using present extension.

v2: Use a seprate linear buffer for each back buffer (Michel)
v3: Change variable names and fix coding style (Leo and Emil)
v4: Use PIPE_BIND_SAMPLER_VIEW for back buffer in case when
 a seprate linear buffer is used (Michel)
v4.1: remove empty line

Signed-off-by: Nayan Deshmukh mailto:nayan26deshm...@gmail.com>>
---
  src/gallium/auxiliary/vl/vl_winsys_dri3.c | 61
---
  1 file changed, 48 insertions(+), 13 deletions(-)

diff --git a/src/gallium/auxiliary/vl/vl_winsys_dri3.c
b/src/gallium/auxiliary/vl/vl_winsys_dri3.c
index 3d596a6..e0aaad8 100644
--- a/src/gallium/auxiliary/vl/vl_winsys_dri3.c
+++ b/src/gallium/auxiliary/vl/vl_winsys_dri3.c
@@ -49,6 +49,7 @@
  struct vl_dri3_buffer
  {
 struct pipe_resource *texture;
+   struct pipe_resource *linear_texture;
   uint32_t pixmap;
 uint32_t sync_fence;
@@ -69,6 +70,8 @@ struct vl_dri3_screen
 xcb_present_event_t eid;
 xcb_special_event_t *special_event;
  +   struct pipe_context *pipe;
+
 struct vl_dri3_buffer *back_buffers[BACK_BUFFER_NUM];
 int cur_back;
  @@ -82,6 +85,7 @@ struct vl_dri3_screen
 int64_t last_ust, ns_frame, last_msc, next_msc;
   bool flushed;
+   bool is_different_gpu;
  };
static void
@@ -102,6 +106,8 @@ dri3_free_back_buffer(struct
vl_dri3_screen *scrn,
 xcb_sync_destroy_fence(scrn->conn, buffer->sync_fence);
 xshmfence_unmap_shm(buffer->shm_fence);
 pipe_resource_reference(&buffer->texture, NULL);
+   if (buffer->linear_texture)
+   pipe_resource_reference(&buffer->linear_texture, NULL);
 FREE(buffer);
  }
  @@ -209,7 +215,7 @@ dri3_alloc_back_buffer(struct
vl_dri3_screen *scrn)
 xcb_sync_fence_t sync_fence;
 struct xshmfence *shm_fence;
 int buffer_fd, fence_fd;
-   struct pipe_resource templ;
+   struct pipe_resource templ, *pixmap_buffer_texture;
 struct winsys_handle whandle;
 unsigned usage;
  @@ -226,8 +232,7 @@ dri3_alloc_back_buffer(struct
vl_dri3_screen *scrn)
goto close_fd;
   memset(&templ, 0, sizeof(templ));
-   templ.bind = PIPE_BIND_RENDER_TARGET |
PIPE_BIND_SAMPLER_VIEW |
-PIPE_BIND_SCANOUT | PIPE_BIND_SHARED;
+   templ.bind = PIPE_BIND_RENDER_TARGET | PIPE_BIND_SAMPLER_VIEW;
 templ.format = PIPE_FORMAT_B8G8R8X8_UNORM;
 templ.target = PIPE_TEXTURE_2D;
 templ.last_level = 0;
@@ -235,16 +240,34 @@ dri3_alloc_back_buffer(struct
vl_dri3_screen *scrn)
 templ.height0 = scrn->height;
 templ.depth0 = 1;
 templ.array_size = 1;
-   buffer->texture =
scrn->base.pscreen->resource_create(scrn->base.pscreen,
-&templ);
-   if (!buffer->texture)
-  goto unmap_shm;
  +   if (scrn->is_different_gpu) {
+  buffer->texture =
scrn->base.pscreen->resource_create(scrn->base.pscreen,
+   &templ);
+  if (!buffer->texture)
+ goto unmap_shm;
+
+  templ.bind |= PIPE_BIND_SCANOUT | PIPE_BIND_SHARED |
+PIPE_BIND_LINEAR;
+  buffer->linear_texture =
scrn->base.pscreen->resource_create(scrn->base.pscreen,
+ &templ);
+  pixmap_buffer_texture = buffer->linear_texture;
+
+  if (!buffer->linear_texture)
+ goto no_linear_texture;
+   } else {
+  templ.bind |= PIPE_BIND_SCANOUT | PIPE_BIND_SHARED;
+  buffer->texture =
scrn->base.pscreen->resource_create(scrn->base.pscreen,
+   &templ);
+  if (!buffer->texture)
+ goto unmap_shm;
+  pixmap_buffer_texture = buffer->texture;
+   }
 memset(&whandle, 0, sizeof(whandle));
 whan

Re: [Mesa-dev] [PATCH] vl/dri3: handle the case of different GPU(v4.1)

2016-09-17 Thread Nayan Deshmukh
Hi Leo,

Could you push the patches? I don't have the push access.

Regards,
Nayan.

On Fri, Sep 16, 2016 at 7:44 PM, Leo Liu  wrote:

> This Patch is Reviewed-by: Leo Liu 
>
>
> On 09/16/2016 08:51 AM, Nayan Deshmukh wrote:
>
>> In case of prime when rendering is done on GPU other then the
>> server GPU, use a seprate linear buffer for each back buffer
>> which will be displayed using present extension.
>>
>> v2: Use a seprate linear buffer for each back buffer (Michel)
>> v3: Change variable names and fix coding style (Leo and Emil)
>> v4: Use PIPE_BIND_SAMPLER_VIEW for back buffer in case when
>>  a seprate linear buffer is used (Michel)
>> v4.1: remove empty line
>>
>> Signed-off-by: Nayan Deshmukh 
>> ---
>>   src/gallium/auxiliary/vl/vl_winsys_dri3.c | 61
>> ---
>>   1 file changed, 48 insertions(+), 13 deletions(-)
>>
>> diff --git a/src/gallium/auxiliary/vl/vl_winsys_dri3.c
>> b/src/gallium/auxiliary/vl/vl_winsys_dri3.c
>> index 3d596a6..e0aaad8 100644
>> --- a/src/gallium/auxiliary/vl/vl_winsys_dri3.c
>> +++ b/src/gallium/auxiliary/vl/vl_winsys_dri3.c
>> @@ -49,6 +49,7 @@
>>   struct vl_dri3_buffer
>>   {
>>  struct pipe_resource *texture;
>> +   struct pipe_resource *linear_texture;
>>uint32_t pixmap;
>>  uint32_t sync_fence;
>> @@ -69,6 +70,8 @@ struct vl_dri3_screen
>>  xcb_present_event_t eid;
>>  xcb_special_event_t *special_event;
>>   +   struct pipe_context *pipe;
>> +
>>  struct vl_dri3_buffer *back_buffers[BACK_BUFFER_NUM];
>>  int cur_back;
>>   @@ -82,6 +85,7 @@ struct vl_dri3_screen
>>  int64_t last_ust, ns_frame, last_msc, next_msc;
>>bool flushed;
>> +   bool is_different_gpu;
>>   };
>> static void
>> @@ -102,6 +106,8 @@ dri3_free_back_buffer(struct vl_dri3_screen *scrn,
>>  xcb_sync_destroy_fence(scrn->conn, buffer->sync_fence);
>>  xshmfence_unmap_shm(buffer->shm_fence);
>>  pipe_resource_reference(&buffer->texture, NULL);
>> +   if (buffer->linear_texture)
>> +   pipe_resource_reference(&buffer->linear_texture, NULL);
>>  FREE(buffer);
>>   }
>>   @@ -209,7 +215,7 @@ dri3_alloc_back_buffer(struct vl_dri3_screen *scrn)
>>  xcb_sync_fence_t sync_fence;
>>  struct xshmfence *shm_fence;
>>  int buffer_fd, fence_fd;
>> -   struct pipe_resource templ;
>> +   struct pipe_resource templ, *pixmap_buffer_texture;
>>  struct winsys_handle whandle;
>>  unsigned usage;
>>   @@ -226,8 +232,7 @@ dri3_alloc_back_buffer(struct vl_dri3_screen *scrn)
>> goto close_fd;
>>memset(&templ, 0, sizeof(templ));
>> -   templ.bind = PIPE_BIND_RENDER_TARGET | PIPE_BIND_SAMPLER_VIEW |
>> -PIPE_BIND_SCANOUT | PIPE_BIND_SHARED;
>> +   templ.bind = PIPE_BIND_RENDER_TARGET | PIPE_BIND_SAMPLER_VIEW;
>>  templ.format = PIPE_FORMAT_B8G8R8X8_UNORM;
>>  templ.target = PIPE_TEXTURE_2D;
>>  templ.last_level = 0;
>> @@ -235,16 +240,34 @@ dri3_alloc_back_buffer(struct vl_dri3_screen *scrn)
>>  templ.height0 = scrn->height;
>>  templ.depth0 = 1;
>>  templ.array_size = 1;
>> -   buffer->texture = scrn->base.pscreen->resource_c
>> reate(scrn->base.pscreen,
>> - &templ);
>> -   if (!buffer->texture)
>> -  goto unmap_shm;
>>   +   if (scrn->is_different_gpu) {
>> +  buffer->texture = scrn->base.pscreen->resource_c
>> reate(scrn->base.pscreen,
>> +&templ);
>> +  if (!buffer->texture)
>> + goto unmap_shm;
>> +
>> +  templ.bind |= PIPE_BIND_SCANOUT | PIPE_BIND_SHARED |
>> +PIPE_BIND_LINEAR;
>> +  buffer->linear_texture = scrn->base.pscreen->resource_c
>> reate(scrn->base.pscreen,
>> +
>> &templ);
>> +  pixmap_buffer_texture = buffer->linear_texture;
>> +
>> +  if (!buffer->linear_texture)
>> + goto no_linear_texture;
>> +   } else {
>> +  templ.bind |= PIPE_BIND_SCANOUT | PIPE_BIND_SHARED;
>> +  buffer->texture = scrn->base.pscreen->resource_c
>> reate(scrn->base.pscreen,
>> +&templ);
>> +  if (!buffer->texture)
>> + goto unmap_shm;
>> +  pixmap_buffer_texture = buffer->texture;
>> +   }
>>  memset(&whandle, 0, sizeof(whandle));
>>  whandle.type= DRM_API_HANDLE_TYPE_FD;
>>  usage = PIPE_HANDLE_USAGE_EXPLICIT_FLUSH | PIPE_HANDLE_USAGE_READ;
>>  scrn->base.pscreen->resource_get_handle(scrn->base.pscreen, NULL,
>> -   buffer->texture, &whandle,
>> +   pixmap_buffer_texture,
>> &whandle,
>>  usage);
>>  buffer_fd = whandle.handle;
>>  buffer->pitch = whandle.stride;
>> @@ -271,6 +294,8 @@ dri3_alloc_back_buffer(struct vl_dri3_screen *scrn)
>>return buffer;
>>   +no_linear_texture:
>> +   pipe_resource_reference(&buffer->texture, NULL);
>>   unmap_sh

Re: [Mesa-dev] [PATCH] vl/dri3: handle the case of different GPU(v4.1)

2016-09-16 Thread Leo Liu

This Patch is Reviewed-by: Leo Liu 

On 09/16/2016 08:51 AM, Nayan Deshmukh wrote:

In case of prime when rendering is done on GPU other then the
server GPU, use a seprate linear buffer for each back buffer
which will be displayed using present extension.

v2: Use a seprate linear buffer for each back buffer (Michel)
v3: Change variable names and fix coding style (Leo and Emil)
v4: Use PIPE_BIND_SAMPLER_VIEW for back buffer in case when
 a seprate linear buffer is used (Michel)
v4.1: remove empty line

Signed-off-by: Nayan Deshmukh 
---
  src/gallium/auxiliary/vl/vl_winsys_dri3.c | 61 ---
  1 file changed, 48 insertions(+), 13 deletions(-)

diff --git a/src/gallium/auxiliary/vl/vl_winsys_dri3.c 
b/src/gallium/auxiliary/vl/vl_winsys_dri3.c
index 3d596a6..e0aaad8 100644
--- a/src/gallium/auxiliary/vl/vl_winsys_dri3.c
+++ b/src/gallium/auxiliary/vl/vl_winsys_dri3.c
@@ -49,6 +49,7 @@
  struct vl_dri3_buffer
  {
 struct pipe_resource *texture;
+   struct pipe_resource *linear_texture;
  
 uint32_t pixmap;

 uint32_t sync_fence;
@@ -69,6 +70,8 @@ struct vl_dri3_screen
 xcb_present_event_t eid;
 xcb_special_event_t *special_event;
  
+   struct pipe_context *pipe;

+
 struct vl_dri3_buffer *back_buffers[BACK_BUFFER_NUM];
 int cur_back;
  
@@ -82,6 +85,7 @@ struct vl_dri3_screen

 int64_t last_ust, ns_frame, last_msc, next_msc;
  
 bool flushed;

+   bool is_different_gpu;
  };
  
  static void

@@ -102,6 +106,8 @@ dri3_free_back_buffer(struct vl_dri3_screen *scrn,
 xcb_sync_destroy_fence(scrn->conn, buffer->sync_fence);
 xshmfence_unmap_shm(buffer->shm_fence);
 pipe_resource_reference(&buffer->texture, NULL);
+   if (buffer->linear_texture)
+   pipe_resource_reference(&buffer->linear_texture, NULL);
 FREE(buffer);
  }
  
@@ -209,7 +215,7 @@ dri3_alloc_back_buffer(struct vl_dri3_screen *scrn)

 xcb_sync_fence_t sync_fence;
 struct xshmfence *shm_fence;
 int buffer_fd, fence_fd;
-   struct pipe_resource templ;
+   struct pipe_resource templ, *pixmap_buffer_texture;
 struct winsys_handle whandle;
 unsigned usage;
  
@@ -226,8 +232,7 @@ dri3_alloc_back_buffer(struct vl_dri3_screen *scrn)

goto close_fd;
  
 memset(&templ, 0, sizeof(templ));

-   templ.bind = PIPE_BIND_RENDER_TARGET | PIPE_BIND_SAMPLER_VIEW |
-PIPE_BIND_SCANOUT | PIPE_BIND_SHARED;
+   templ.bind = PIPE_BIND_RENDER_TARGET | PIPE_BIND_SAMPLER_VIEW;
 templ.format = PIPE_FORMAT_B8G8R8X8_UNORM;
 templ.target = PIPE_TEXTURE_2D;
 templ.last_level = 0;
@@ -235,16 +240,34 @@ dri3_alloc_back_buffer(struct vl_dri3_screen *scrn)
 templ.height0 = scrn->height;
 templ.depth0 = 1;
 templ.array_size = 1;
-   buffer->texture = scrn->base.pscreen->resource_create(scrn->base.pscreen,
- &templ);
-   if (!buffer->texture)
-  goto unmap_shm;
  
+   if (scrn->is_different_gpu) {

+  buffer->texture = scrn->base.pscreen->resource_create(scrn->base.pscreen,
+&templ);
+  if (!buffer->texture)
+ goto unmap_shm;
+
+  templ.bind |= PIPE_BIND_SCANOUT | PIPE_BIND_SHARED |
+PIPE_BIND_LINEAR;
+  buffer->linear_texture = 
scrn->base.pscreen->resource_create(scrn->base.pscreen,
+  &templ);
+  pixmap_buffer_texture = buffer->linear_texture;
+
+  if (!buffer->linear_texture)
+ goto no_linear_texture;
+   } else {
+  templ.bind |= PIPE_BIND_SCANOUT | PIPE_BIND_SHARED;
+  buffer->texture = scrn->base.pscreen->resource_create(scrn->base.pscreen,
+&templ);
+  if (!buffer->texture)
+ goto unmap_shm;
+  pixmap_buffer_texture = buffer->texture;
+   }
 memset(&whandle, 0, sizeof(whandle));
 whandle.type= DRM_API_HANDLE_TYPE_FD;
 usage = PIPE_HANDLE_USAGE_EXPLICIT_FLUSH | PIPE_HANDLE_USAGE_READ;
 scrn->base.pscreen->resource_get_handle(scrn->base.pscreen, NULL,
-   buffer->texture, &whandle,
+   pixmap_buffer_texture, &whandle,
 usage);
 buffer_fd = whandle.handle;
 buffer->pitch = whandle.stride;
@@ -271,6 +294,8 @@ dri3_alloc_back_buffer(struct vl_dri3_screen *scrn)
  
 return buffer;
  
+no_linear_texture:

+   pipe_resource_reference(&buffer->texture, NULL);
  unmap_shm:
 xshmfence_unmap_shm(shm_fence);
  close_fd:
@@ -474,6 +499,7 @@ vl_dri3_flush_frontbuffer(struct pipe_screen *screen,
 struct vl_dri3_screen *scrn = (struct vl_dri3_screen *)context_private;
 uint32_t options = XCB_PRESENT_OPTION_NONE;
 struct vl_dri3_buffer *back;
+   struct pipe_box src_box;
  
 back = scrn->back_buffers[scrn->cur_back];

 if (!back)
@@ -485,6 +511,16 @@