[Mesa-dev] [Mesa-stable] [PATCH] egl/wayland: Don't use DRM format codes for SHM
Daniel Stone
daniel at fooishbar.org
Mon Feb 13 17:34:49 UTC 2017
Hey,
On 13 February 2017 at 17:27, Emil Velikov <emil.l.velikov at gmail.com> wrote:
> On 13 February 2017 at 14:06, Daniel Stone <daniels at collabora.com> wrote:
>> static EGLBoolean
>> dri2_wl_swrast_allocate_buffer(struct dri2_egl_display *dri2_dpy,
>> - int format, int w, int h,
>> + int drm_format, int w, int h,
>> void **data, int *size,
>> struct wl_buffer **buffer)
>> {
>> struct wl_shm_pool *pool;
>> + uint32_t shm_format;
>> int fd, stride, size_map;
>> void *data_map;
>>
>> - stride = dri2_wl_swrast_get_stride_for_format(format, w);
>> + switch (drm_format) {
>> + case WL_DRM_FORMAT_RGB565:
>> + shm_format = WL_SHM_FORMAT_RGB565;
>> + break;
>> + case WL_DRM_FORMAT_ARGB8888:
>> + shm_format = WL_SHM_FORMAT_ARGB8888;
>> + break;
>> + case WL_DRM_FORMAT_XRGB8888:
>> + shm_format = WL_SHM_FORMAT_XRGB8888;
>> + break;
>> + default:
>> + return EGL_FALSE;
>> + }
>
> Wouldn't it be better to have this in dri2_wl_create_window_surface() ?
> As-is we're passing the DRM formats on the wire, which is quite likely
> to cause issues elsewhere.
There were a few other codepaths touching the format that seemed like
they might be affected. This is the only one which actually hits the
wire (AFAICT - which others are you thinking of ... ?), so that seemed
like it was the easiest.
Cheers,
Daniel
More information about the mesa-dev
mailing list