Re: [Mesa-dev] [PATCH 1/3] mesa: add xbgr support adjacent to xrgb

2018-02-09 Thread Ilia Mirkin
On Tue, Feb 6, 2018 at 12:05 AM, Ilia Mirkin  wrote:
> On Mon, Feb 5, 2018 at 6:42 AM, Ilia Mirkin  wrote:
>> On Mon, Feb 5, 2018 at 6:24 AM, Daniel Stone  wrote:
>>> Hi Ilia,
>>>
>>> On 4 February 2018 at 19:09, Ilia Mirkin  wrote:
 One might have split this up into multiple patches, but it's just very
 repetitive and similar code.
>>>
>>> You probably want to add this into gbm_to_dri_image_formats[] inside
>>> src/gbm/backends/dri/gbm_dri.c, so Wayland compositors running on KMS
>>> and xf86-video-modesetting can also use these modes.
>>>
>>> Grepping for XRGB210 inside src/egl/drivers/dri2/platform_wayland.c
>>> would also show the fairly obvious points to add it there.
>>
>> I thought I covered all the places where this was done, but obviously
>> not. Perhaps in my euphoria of getting glxgears displaying the correct
>> colors I decided I was done.
>>
>> I'll do another passthrough, and definitely hit that file explicitly.
>
> So I've been looking at platform_wayland and platform_x11, and it's
> not totally clear to me how to make it all work. I'm stuck with e.g.
>
> dri2_wl_create_window_surface
> dri3_create_image_khr_pixmap
>
> and others, wrt how to determine whether I should pick a XBGR or XRGB
> format. I suspect that more information has to be stored somewhere.
> Perhaps the _EGLConfig? Even that wouldn't cover everything though.
> This is all quite foreign to me, and I'm not sure how it's supposed to
> all fit together. Perhaps it can be left until later?

To sum up the IRC discussion and other series --

(a) Daniel wrote and pushed the support for most of EGL. Any remaining
bits can be added as needed.
(b) Daniel acked this series, provided that I remove the stray vdpau change.

Unless there's other feedback, I'm going to push this out.

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


Re: [Mesa-dev] [PATCH 1/3] mesa: add xbgr support adjacent to xrgb

2018-02-05 Thread Ilia Mirkin
On Mon, Feb 5, 2018 at 6:42 AM, Ilia Mirkin  wrote:
> On Mon, Feb 5, 2018 at 6:24 AM, Daniel Stone  wrote:
>> Hi Ilia,
>>
>> On 4 February 2018 at 19:09, Ilia Mirkin  wrote:
>>> One might have split this up into multiple patches, but it's just very
>>> repetitive and similar code.
>>
>> You probably want to add this into gbm_to_dri_image_formats[] inside
>> src/gbm/backends/dri/gbm_dri.c, so Wayland compositors running on KMS
>> and xf86-video-modesetting can also use these modes.
>>
>> Grepping for XRGB210 inside src/egl/drivers/dri2/platform_wayland.c
>> would also show the fairly obvious points to add it there.
>
> I thought I covered all the places where this was done, but obviously
> not. Perhaps in my euphoria of getting glxgears displaying the correct
> colors I decided I was done.
>
> I'll do another passthrough, and definitely hit that file explicitly.

So I've been looking at platform_wayland and platform_x11, and it's
not totally clear to me how to make it all work. I'm stuck with e.g.

dri2_wl_create_window_surface
dri3_create_image_khr_pixmap

and others, wrt how to determine whether I should pick a XBGR or XRGB
format. I suspect that more information has to be stored somewhere.
Perhaps the _EGLConfig? Even that wouldn't cover everything though.
This is all quite foreign to me, and I'm not sure how it's supposed to
all fit together. Perhaps it can be left until later?

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


Re: [Mesa-dev] [PATCH 1/3] mesa: add xbgr support adjacent to xrgb

2018-02-05 Thread Ilia Mirkin
On Mon, Feb 5, 2018 at 6:24 AM, Daniel Stone  wrote:
> Hi Ilia,
>
> On 4 February 2018 at 19:09, Ilia Mirkin  wrote:
>> One might have split this up into multiple patches, but it's just very
>> repetitive and similar code.
>
> You probably want to add this into gbm_to_dri_image_formats[] inside
> src/gbm/backends/dri/gbm_dri.c, so Wayland compositors running on KMS
> and xf86-video-modesetting can also use these modes.
>
> Grepping for XRGB210 inside src/egl/drivers/dri2/platform_wayland.c
> would also show the fairly obvious points to add it there.

I thought I covered all the places where this was done, but obviously
not. Perhaps in my euphoria of getting glxgears displaying the correct
colors I decided I was done.

I'll do another passthrough, and definitely hit that file explicitly.

Thanks!

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


Re: [Mesa-dev] [PATCH 1/3] mesa: add xbgr support adjacent to xrgb

2018-02-05 Thread Daniel Stone
Hi Ilia,

On 4 February 2018 at 19:09, Ilia Mirkin  wrote:
> One might have split this up into multiple patches, but it's just very
> repetitive and similar code.

You probably want to add this into gbm_to_dri_image_formats[] inside
src/gbm/backends/dri/gbm_dri.c, so Wayland compositors running on KMS
and xf86-video-modesetting can also use these modes.

Grepping for XRGB210 inside src/egl/drivers/dri2/platform_wayland.c
would also show the fairly obvious points to add it there.

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


[Mesa-dev] [PATCH 1/3] mesa: add xbgr support adjacent to xrgb

2018-02-04 Thread Ilia Mirkin
Signed-off-by: Ilia Mirkin 
---

One might have split this up into multiple patches, but it's just very
repetitive and similar code.

 include/GL/internal/dri_interface.h   |  2 ++
 src/gallium/state_trackers/dri/dri2.c | 36 +++
 src/gallium/state_trackers/dri/dri_drawable.c |  3 +++
 src/gallium/state_trackers/dri/dri_screen.c   | 17 -
 src/gallium/state_trackers/vdpau/device.c |  2 +-
 src/loader/loader_dri3_helper.c   |  4 +++
 src/mesa/drivers/dri/common/utils.c   | 10 
 src/mesa/main/framebuffer.c   |  4 ++-
 src/mesa/state_tracker/st_cb_fbo.c|  2 ++
 9 files changed, 77 insertions(+), 3 deletions(-)

diff --git a/include/GL/internal/dri_interface.h 
b/include/GL/internal/dri_interface.h
index 34a5c9fb01a..dfee806885b 100644
--- a/include/GL/internal/dri_interface.h
+++ b/include/GL/internal/dri_interface.h
@@ -1227,6 +1227,8 @@ struct __DRIdri2ExtensionRec {
 #define __DRI_IMAGE_FORMAT_R16  0x100d
 #define __DRI_IMAGE_FORMAT_GR1616   0x100e
 #define __DRI_IMAGE_FORMAT_YUYV 0x100f
+#define __DRI_IMAGE_FORMAT_XBGR2101010  0x1010
+#define __DRI_IMAGE_FORMAT_ABGR2101010  0x1011
 
 #define __DRI_IMAGE_USE_SHARE  0x0001
 #define __DRI_IMAGE_USE_SCANOUT0x0002
diff --git a/src/gallium/state_trackers/dri/dri2.c 
b/src/gallium/state_trackers/dri/dri2.c
index 415002d2cd0..2a3a2a805b4 100644
--- a/src/gallium/state_trackers/dri/dri2.c
+++ b/src/gallium/state_trackers/dri/dri2.c
@@ -57,6 +57,8 @@
 static const int fourcc_formats[] = {
__DRI_IMAGE_FOURCC_ARGB2101010,
__DRI_IMAGE_FOURCC_XRGB2101010,
+   __DRI_IMAGE_FOURCC_ABGR2101010,
+   __DRI_IMAGE_FOURCC_XBGR2101010,
__DRI_IMAGE_FOURCC_ARGB,
__DRI_IMAGE_FOURCC_ABGR,
__DRI_IMAGE_FOURCC_SARGB,
@@ -115,6 +117,14 @@ static int convert_fourcc(int format, int 
*dri_components_p)
   format = __DRI_IMAGE_FORMAT_XRGB2101010;
   dri_components = __DRI_IMAGE_COMPONENTS_RGB;
   break;
+   case __DRI_IMAGE_FOURCC_ABGR2101010:
+  format = __DRI_IMAGE_FORMAT_ABGR2101010;
+  dri_components = __DRI_IMAGE_COMPONENTS_RGBA;
+  break;
+   case __DRI_IMAGE_FOURCC_XBGR2101010:
+  format = __DRI_IMAGE_FORMAT_XBGR2101010;
+  dri_components = __DRI_IMAGE_COMPONENTS_RGB;
+  break;
case __DRI_IMAGE_FOURCC_R8:
   format = __DRI_IMAGE_FORMAT_R8;
   dri_components = __DRI_IMAGE_COMPONENTS_R;
@@ -186,6 +196,12 @@ static int convert_to_fourcc(int format)
case __DRI_IMAGE_FORMAT_XRGB2101010:
   format = __DRI_IMAGE_FOURCC_XRGB2101010;
   break;
+   case __DRI_IMAGE_FORMAT_ABGR2101010:
+  format = __DRI_IMAGE_FOURCC_ABGR2101010;
+  break;
+   case __DRI_IMAGE_FORMAT_XBGR2101010:
+  format = __DRI_IMAGE_FOURCC_XBGR2101010;
+  break;
case __DRI_IMAGE_FORMAT_R8:
   format = __DRI_IMAGE_FOURCC_R8;
   break;
@@ -224,6 +240,12 @@ static enum pipe_format dri2_format_to_pipe_format (int 
format)
case __DRI_IMAGE_FORMAT_ARGB2101010:
   pf = PIPE_FORMAT_B10G10R10A2_UNORM;
   break;
+   case __DRI_IMAGE_FORMAT_XBGR2101010:
+  pf = PIPE_FORMAT_R10G10B10X2_UNORM;
+  break;
+   case __DRI_IMAGE_FORMAT_ABGR2101010:
+  pf = PIPE_FORMAT_R10G10B10A2_UNORM;
+  break;
case __DRI_IMAGE_FORMAT_R8:
   pf = PIPE_FORMAT_R8_UNORM;
   break;
@@ -288,6 +310,12 @@ static enum pipe_format fourcc_to_pipe_format(int fourcc)
case __DRI_IMAGE_FOURCC_XRGB2101010:
   pf = PIPE_FORMAT_B10G10R10X2_UNORM;
   break;
+   case __DRI_IMAGE_FOURCC_ABGR2101010:
+  pf = PIPE_FORMAT_R10G10B10A2_UNORM;
+  break;
+   case __DRI_IMAGE_FOURCC_XBGR2101010:
+  pf = PIPE_FORMAT_R10G10B10X2_UNORM;
+  break;
 
case __DRI_IMAGE_FOURCC_NV12:
   pf = PIPE_FORMAT_NV12;
@@ -406,10 +434,12 @@ dri2_drawable_get_buffers(struct dri_drawable *drawable,
*/
   switch(format) {
   case PIPE_FORMAT_B10G10R10A2_UNORM:
+  case PIPE_FORMAT_R10G10B10A2_UNORM:
   case PIPE_FORMAT_BGRA_UNORM:
   case PIPE_FORMAT_RGBA_UNORM:
 depth = 32;
 break;
+  case PIPE_FORMAT_R10G10B10X2_UNORM:
   case PIPE_FORMAT_B10G10R10X2_UNORM:
  depth = 30;
  break;
@@ -502,6 +532,12 @@ dri_image_drawable_get_buffers(struct dri_drawable 
*drawable,
   case PIPE_FORMAT_B10G10R10A2_UNORM:
  image_format = __DRI_IMAGE_FORMAT_ARGB2101010;
  break;
+  case PIPE_FORMAT_R10G10B10X2_UNORM:
+ image_format = __DRI_IMAGE_FORMAT_XBGR2101010;
+ break;
+  case PIPE_FORMAT_R10G10B10A2_UNORM:
+ image_format = __DRI_IMAGE_FORMAT_ABGR2101010;
+ break;
   default:
  image_format = __DRI_IMAGE_FORMAT_NONE;
  break;
diff --git a/src/gallium/state_trackers/dri/dri_drawable.c 
b/src/gallium/state_trackers/dri/dri_drawable.c
index a5999be574a..e5a7537e473 100644
---