drm/bochs: fix framebuffer setup.
Subsystems (3)
PATCH 2/2 drm/bochs: fix framebuffer setup.
In reply to Gerd HoffmannIf bo->width doesn't match fb->width the driver fails to configure the display correctly, resulting in a scrambled display. Fix it.
--- drivers/gpu/drm/bochs/bochs.h | 2 +- drivers/gpu/drm/bochs/bochs_hw.c | 13 +++++++++---- drivers/gpu/drm/bochs/bochs_kms.c | 1 + 3 files changed, 11 insertions(+), 5 deletions(-)
drivers/gpu/drm/bochs/bochs.h +1 -1
@@ -86,7 +86,7 @@ void bochs_hw_setmode(struct bochs_device *bochs,void bochs_hw_setformat (struct bochs_device *bochs,const struct drm_format_info *format);void bochs_hw_setbase (struct bochs_device *bochs, -int x,int y,u64 addr); +int x,int y,int fbwidth,u64 addr);int bochs_hw_load_edid (struct bochs_device *bochs);/* bochs_mm.c */
drivers/gpu/drm/bochs/bochs_hw.c +9 -4
@@ -255,16 +255,21 @@ void bochs_hw_setformat(struct bochs_device *bochs, }void bochs_hw_setbase (struct bochs_device *bochs, -int x,int y,u64 addr) +int x,int y,int fbwidth,u64 addr) { -unsigned long offset = (unsigned long )addr + +unsigned long offset; +unsigned int vx, vy; + + bochs->stride = fbwidth * (bochs->bpp /8 ); + offset = (unsigned long )addr + y * bochs->stride + x * (bochs->bpp /8 ); -int vy = offset / bochs->stride; -int vx = (offset % bochs->stride) *8 / bochs->bpp; + vy = offset / bochs->stride; + vx = (offset % bochs->stride) *8 / bochs->bpp;DRM_DEBUG_DRIVER ("x %d, y %d, addr %llx -> offset %lx, vx %d, vy %d\n" , x, y, addr, offset, vx, vy); +bochs_dispi_write (bochs,VBE_DISPI_INDEX_VIRT_WIDTH , fbwidth);bochs_dispi_write (bochs,VBE_DISPI_INDEX_X_OFFSET , vx);bochs_dispi_write (bochs,VBE_DISPI_INDEX_Y_OFFSET , vy); }
drivers/gpu/drm/bochs/bochs_kms.c +1 -0
@@ -36,6 +36,7 @@ static void bochs_plane_update(struct bochs_device *bochs,bochs_hw_setbase (bochs, state->crtc_x, state->crtc_y, + gbo->width, gbo->bo.offset);bochs_hw_setformat (bochs, state->fb->format); }
Signature · 1 line
2.18.1
PATCH 2/2 drm/bochs: fix framebuffer setup.
In reply to Gerd HoffmannIf bo->width doesn't match fb->width the driver fails to configure the display correctly, resulting in a scrambled display. Fix it.
--- drivers/gpu/drm/bochs/bochs.h | 2 +- drivers/gpu/drm/bochs/bochs_hw.c | 13 +++++++++---- drivers/gpu/drm/bochs/bochs_kms.c | 1 + 3 files changed, 11 insertions(+), 5 deletions(-)
drivers/gpu/drm/bochs/bochs.h +1 -1
@@ -86,7 +86,7 @@ void bochs_hw_setmode(struct bochs_device *bochs,void bochs_hw_setformat (struct bochs_device *bochs,const struct drm_format_info *format);void bochs_hw_setbase (struct bochs_device *bochs, -int x,int y,u64 addr); +int x,int y,int fbwidth,u64 addr);int bochs_hw_load_edid (struct bochs_device *bochs);/* bochs_mm.c */
drivers/gpu/drm/bochs/bochs_hw.c +9 -4
@@ -255,16 +255,21 @@ void bochs_hw_setformat(struct bochs_device *bochs, }void bochs_hw_setbase (struct bochs_device *bochs, -int x,int y,u64 addr) +int x,int y,int fbwidth,u64 addr) { -unsigned long offset = (unsigned long )addr + +unsigned long offset; +unsigned int vx, vy; + + bochs->stride = fbwidth * (bochs->bpp /8 ); + offset = (unsigned long )addr + y * bochs->stride + x * (bochs->bpp /8 ); -int vy = offset / bochs->stride; -int vx = (offset % bochs->stride) *8 / bochs->bpp; + vy = offset / bochs->stride; + vx = (offset % bochs->stride) *8 / bochs->bpp;DRM_DEBUG_DRIVER ("x %d, y %d, addr %llx -> offset %lx, vx %d, vy %d\n" , x, y, addr, offset, vx, vy); +bochs_dispi_write (bochs,VBE_DISPI_INDEX_VIRT_WIDTH , fbwidth);bochs_dispi_write (bochs,VBE_DISPI_INDEX_X_OFFSET , vx);bochs_dispi_write (bochs,VBE_DISPI_INDEX_Y_OFFSET , vy); }
drivers/gpu/drm/bochs/bochs_kms.c +1 -0
@@ -36,6 +36,7 @@ static void bochs_plane_update(struct bochs_device *bochs,bochs_hw_setbase (bochs, state->crtc_x, state->crtc_y, + gbo->width, gbo->bo.offset);bochs_hw_setformat (bochs, state->fb->format); }
Signature · 1 line
2.18.1
cover drm/bochs: fix framebuffer setup.
If bo->width doesn't match fb->width the driver fails to configure the display correctly, resulting in a scrambled display.
This little series has a patch for vram, to store bo->width (1/2), and the actual bugfix (2/2). The other drivers using the vram helpers are probably affected too.
Reproducer: Run gnome-shell in wayland mode. It'll round up the bo dimensions to a multiple of 64 (for tiling I guess). Somewhat odd display resolutions will reproduce the bug. Example: An 800x600 framebuffer will use an 832x640 bo.
Gerd Hoffmann (2):
drm/vram: store dumb bo dimensions.
drm/bochs: fix framebuffer setup.
drivers/gpu/drm/bochs/bochs.h | 2 +- include/drm/drm_gem_vram_helper.h | 1 + drivers/gpu/drm/bochs/bochs_hw.c | 13 +++++++++---- drivers/gpu/drm/bochs/bochs_kms.c | 1 + drivers/gpu/drm/drm_gem_vram_helper.c | 2 ++ 5 files changed, 14 insertions(+), 5 deletions(-)
Signature · 6 lines
2.18.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/2 drm/vram: store dumb bo dimensions.
Store width and height of the bo. Needed in case userspace sets up a framebuffer with fb->width != bo->width..
--- include/drm/drm_gem_vram_helper.h | 1 + drivers/gpu/drm/drm_gem_vram_helper.c | 2 ++ 2 files changed, 3 insertions(+)
include/drm/drm_gem_vram_helper.h +1 -0
@@ -39,6 +39,7 @@ struct drm_gem_vram_object {struct drm_gem_object gem;struct ttm_buffer_object bo;struct ttm_bo_kmap_obj kmap; +unsigned int width, height;/* Supported placements are %TTM_PL_VRAM and %TTM_PL_SYSTEM */ struct ttm_placement placement;
drivers/gpu/drm/drm_gem_vram_helper.c +2 -0
@@ -377,6 +377,8 @@ int drm_gem_vram_fill_create_dumb(struct drm_file *file, gbo =drm_gem_vram_create (dev, bdev, size, pg_align, interruptible);if (IS_ERR (gbo))return PTR_ERR (gbo); + gbo->width = args->width; + gbo->height = args->height; ret =drm_gem_handle_create (file, &gbo->gem, &handle);if (ret)
Signature · 6 lines
2.18.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 1/2] drm/vram: store dumb bo dimensions.
Hi Gerd.
Quoted 26 lines · Gerd Hoffmann
Store width and height of the bo. Needed in case userspace sets up a framebuffer with
fb->width!=bo->width..Signed-off-by Gerd Hoffmann <[email protected]>--- include/drm/drm_gem_vram_helper.h | 1 + drivers/gpu/drm/drm_gem_vram_helper.c | 2 ++ 2 files changed, 3 insertions(+)include/drm/drm_gem_vram_helper.h +1
-0@@ -39,6 +39,7 @@ struct drm_gem_vram_object {struct drm_gem_object gem;struct ttm_buffer_object bo;struct ttm_bo_kmap_obj kmap; +unsigned int width, height;/* Supported placements are %TTM_PL_VRAM and %TTM_PL_SYSTEM */ struct ttm_placement placement;drivers/gpu/drm/drm_gem_vram_helper.c +0
-0
drivers/gpu/drm/drm_gem_vram_helper.c int drm_gem_vram_fill_create_dumb(struct drm_file *file, · line 384
Quoted 8 lines
drivers/gpu/drm/drm_gem_vram_helper.c +2
-0@@ -377,6 +377,8 @@ int drm_gem_vram_fill_create_dumb(struct drm_file *file, gbo =drm_gem_vram_create (dev, bdev, size, pg_align, interruptible);if (IS_ERR (gbo))return PTR_ERR (gbo); + gbo->width = args->width; + gbo->height = args->height; ret =drm_gem_handle_create (file, &gbo->gem, &handle);if (ret)
Be warned, I may have missed something in the bigger picture.
Your patch will set width and height only for dumb bo's But we have several users of drm_gem_vram_create() that will not set the width and height.
So only in some cases can we rely on them being set. Should this be refactored so we always set width, height. Or maybe say in a small comment that width,height are only set for dumb bo's?
Sam
Re: [PATCH 1/2] drm/vram: store dumb bo dimensions.
Quoted 40 lines · Sam Ravnborg
Hi Gerd.
Quoted 26 lines · Gerd Hoffmann
Store width and height of the bo. Needed in case userspace sets up a framebuffer with
fb->width!=bo->width..Signed-off-by Gerd Hoffmann <[email protected]>--- include/drm/drm_gem_vram_helper.h | 1 + drivers/gpu/drm/drm_gem_vram_helper.c | 2 ++ 2 files changed, 3 insertions(+)include/drm/drm_gem_vram_helper.h +1
-0@@ -39,6 +39,7 @@ struct drm_gem_vram_object {struct drm_gem_object gem;struct ttm_buffer_object bo;struct ttm_bo_kmap_obj kmap; +unsigned int width, height;/* Supported placements are %TTM_PL_VRAM and %TTM_PL_SYSTEM */ struct ttm_placement placement;drivers/gpu/drm/drm_gem_vram_helper.c +0
-0drivers/gpu/drm/drm_gem_vram_helper.c int drm_gem_vram_fill_create_dumb(struct drm_file *file, · line 384
Quoted 8 lines
drivers/gpu/drm/drm_gem_vram_helper.c +2
-0@@ -377,6 +377,8 @@ int drm_gem_vram_fill_create_dumb(struct drm_file *file, gbo =drm_gem_vram_create (dev, bdev, size, pg_align, interruptible);if (IS_ERR (gbo))return PTR_ERR (gbo); + gbo->width = args->width; + gbo->height = args->height; ret =drm_gem_handle_create (file, &gbo->gem, &handle);if (ret)Be warned, I may have missed something in the bigger picture.
Quoted 8 lines
Your patch will set width and height only for dumb bo's But we have several users of
drm_gem_vram_create()that will not set the width and height.So only in some cases can we rely on them being set. Should this be refactored so we always set width, height. Or maybe say in a small comment that width,height are only set for dumb bo's?
Also for dumb bo allocated buffers if userspace gets the dimensions wrong between dumb_create and the addfb, something is wrong. Papering over that by remembering the right dimensions doesn't look like a good solution. -Daniel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 58 lines · Gerd Hoffmann
If
bo->widthdoesn't matchfb->widththe driver fails to configure the display correctly, resulting in a scrambled display. Fix it.Signed-off-by Gerd Hoffmann <[email protected]>--- drivers/gpu/drm/bochs/bochs.h | 2 +- drivers/gpu/drm/bochs/bochs_hw.c | 13 +++++++++---- drivers/gpu/drm/bochs/bochs_kms.c | 1 + 3 files changed, 11 insertions(+), 5 deletions(-)drivers/gpu/drm/bochs/bochs.h +1
-1@@ -86,7 +86,7 @@ void bochs_hw_setmode(struct bochs_device *bochs,void bochs_hw_setformat (struct bochs_device *bochs,const struct drm_format_info *format);void bochs_hw_setbase (struct bochs_device *bochs, -int x,int y,u64 addr); +int x,int y,int fbwidth,u64 addr);int bochs_hw_load_edid (struct bochs_device *bochs);/* bochs_mm.c */ drivers/gpu/drm/bochs/bochs_hw.c +9
-4@@ -255,16 +255,21 @@ void bochs_hw_setformat(struct bochs_device *bochs, }void bochs_hw_setbase (struct bochs_device *bochs, -int x,int y,u64 addr) +int x,int y,int fbwidth,u64 addr) { -unsigned long offset = (unsigned long )addr + +unsigned long offset; +unsigned int vx, vy; + + bochs->stride = fbwidth * (bochs->bpp /8 ); + offset = (unsigned long )addr + y * bochs->stride + x * (bochs->bpp /8 ); -int vy = offset / bochs->stride; -int vx = (offset % bochs->stride) *8 / bochs->bpp; + vy = offset / bochs->stride; + vx = (offset % bochs->stride) *8 / bochs->bpp;DRM_DEBUG_DRIVER ("x %d, y %d, addr %llx -> offset %lx, vx %d, vy %d\n" , x, y, addr, offset, vx, vy); +bochs_dispi_write (bochs,VBE_DISPI_INDEX_VIRT_WIDTH , fbwidth);bochs_dispi_write (bochs,VBE_DISPI_INDEX_X_OFFSET , vx);bochs_dispi_write (bochs,VBE_DISPI_INDEX_Y_OFFSET , vy); }drivers/gpu/drm/bochs/bochs_kms.c +0
-0
drivers/gpu/drm/bochs/bochs_kms.c static void bochs_plane_update(struct bochs_device *bochs, · line 39
Quoted 4 lines
drivers/gpu/drm/bochs/bochs_kms.c +1
-0@@ -36,6 +36,7 @@ static void bochs_plane_update(struct bochs_device *bochs, bochs_hw_setbase(bochs, state->crtc_x, state->crtc_y, + gbo->width,
You want the dimensions of the drm_framebuffer here, not something from the underlying gem bo.
drivers/gpu/drm/bochs/bochs_kms.c static void bochs_plane_update(struct bochs_device *bochs, · line 40
Quoted 1 line
drivers/gpu/drm/bochs/bochs_kms.c +0
-0gbo->bo.offset);
I think same here, or at least additionally take into account both drm_framebuffer offset _and_ vram offset.
-Daniel
Quoted 5 lines
drivers/gpu/drm/bochs/bochs_kms.c +0
-0bochs_hw_setformat (bochs, state->fb->format); }Signature · 1 line
2.18.1
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
Quoted 58 lines · Gerd Hoffmann
If
bo->widthdoesn't matchfb->widththe driver fails to configure the display correctly, resulting in a scrambled display. Fix it.Signed-off-by Gerd Hoffmann <[email protected]>--- drivers/gpu/drm/bochs/bochs.h | 2 +- drivers/gpu/drm/bochs/bochs_hw.c | 13 +++++++++---- drivers/gpu/drm/bochs/bochs_kms.c | 1 + 3 files changed, 11 insertions(+), 5 deletions(-)drivers/gpu/drm/bochs/bochs.h +1
-1@@ -86,7 +86,7 @@ void bochs_hw_setmode(struct bochs_device *bochs,void bochs_hw_setformat (struct bochs_device *bochs,const struct drm_format_info *format);void bochs_hw_setbase (struct bochs_device *bochs, -int x,int y,u64 addr); +int x,int y,int fbwidth,u64 addr);int bochs_hw_load_edid (struct bochs_device *bochs);/* bochs_mm.c */ drivers/gpu/drm/bochs/bochs_hw.c +9
-4@@ -255,16 +255,21 @@ void bochs_hw_setformat(struct bochs_device *bochs, }void bochs_hw_setbase (struct bochs_device *bochs, -int x,int y,u64 addr) +int x,int y,int fbwidth,u64 addr) { -unsigned long offset = (unsigned long )addr + +unsigned long offset; +unsigned int vx, vy; + + bochs->stride = fbwidth * (bochs->bpp /8 ); + offset = (unsigned long )addr + y * bochs->stride + x * (bochs->bpp /8 ); -int vy = offset / bochs->stride; -int vx = (offset % bochs->stride) *8 / bochs->bpp; + vy = offset / bochs->stride; + vx = (offset % bochs->stride) *8 / bochs->bpp;DRM_DEBUG_DRIVER ("x %d, y %d, addr %llx -> offset %lx, vx %d, vy %d\n" , x, y, addr, offset, vx, vy); +bochs_dispi_write (bochs,VBE_DISPI_INDEX_VIRT_WIDTH , fbwidth);bochs_dispi_write (bochs,VBE_DISPI_INDEX_X_OFFSET , vx);bochs_dispi_write (bochs,VBE_DISPI_INDEX_Y_OFFSET , vy); }drivers/gpu/drm/bochs/bochs_kms.c +0
-0
drivers/gpu/drm/bochs/bochs_kms.c static void bochs_plane_update(struct bochs_device *bochs, · line 39
Quoted 4 lines
drivers/gpu/drm/bochs/bochs_kms.c +1
-0@@ -36,6 +36,7 @@ static void bochs_plane_update(struct bochs_device *bochs, bochs_hw_setbase(bochs, state->crtc_x, state->crtc_y, + gbo->width,
You want the dimensions of the drm_framebuffer here, not something from the underlying gem bo.
drivers/gpu/drm/bochs/bochs_kms.c static void bochs_plane_update(struct bochs_device *bochs, · line 40
Quoted 1 line
drivers/gpu/drm/bochs/bochs_kms.c +0
-0gbo->bo.offset);
I think same here, or at least additionally take into account both drm_framebuffer offset _and_ vram offset.
-Daniel
Quoted 5 lines
drivers/gpu/drm/bochs/bochs_kms.c +0
-0bochs_hw_setformat (bochs, state->fb->format); }Signature · 1 line
2.18.1
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
Thomas Zimmermann
maintainerRe: [PATCH 1/2] drm/vram: store dumb bo dimensions.
In reply to Gerd HoffmannHi
Am 26.06.19 um 08:55 schrieb Gerd Hoffmann:
Quoted 2 lines
Store width and height of the bo. Needed in case userspace sets up a framebuffer with
fb->width!=bo->width..
This seems like bug. I'd rather return an error to userspace if the BO is incompatible.
For the Gnome issue, a fix would be to program the display HW's line pitch to the correct value.
Best regards
Thomas
Quoted 32 lines
Signed-off-by Gerd Hoffmann <[email protected]>--- include/drm/drm_gem_vram_helper.h | 1 + drivers/gpu/drm/drm_gem_vram_helper.c | 2 ++ 2 files changed, 3 insertions(+)include/drm/drm_gem_vram_helper.h +1
-0@@ -39,6 +39,7 @@ struct drm_gem_vram_object {struct drm_gem_object gem;struct ttm_buffer_object bo;struct ttm_bo_kmap_obj kmap; +unsigned int width, height;/* Supported placements are %TTM_PL_VRAM and %TTM_PL_SYSTEM */ struct ttm_placement placement;drivers/gpu/drm/drm_gem_vram_helper.c +2
-0@@ -377,6 +377,8 @@ int drm_gem_vram_fill_create_dumb(struct drm_file *file, gbo =drm_gem_vram_create (dev, bdev, size, pg_align, interruptible);if (IS_ERR (gbo))return PTR_ERR (gbo); + gbo->width = args->width; + gbo->height = args->height; ret =drm_gem_handle_create (file, &gbo->gem, &handle);if (ret)
Signature · 5 lines
Thomas Zimmermann Graphics Driver Developer SUSE Linux GmbH, Maxfeldstrasse 5, 90409 Nuernberg, Germany GF: Felix Imendörffer, Mary Higgins, Sri Rasiah HRB 21284 (AG Nürnberg)
Re: [PATCH 1/2] drm/vram: store dumb bo dimensions.
Hi,
Quoted 2 lines
For the Gnome issue, a fix would be to program the display HW's line pitch to the correct value.
Yes, and drm_framebuffer actually has the pitches, so no need for this patch indeed.
cheers,
Gerd
Re: [PATCH 1/2] drm/vram: store dumb bo dimensions.
In reply to Daniel VetterQuoted 45 lines · On Wed, 26 Jun 2019 18:27:54 +0200 Daniel Vetter <[email protected]> wrote:
Quoted 44 lines · Sam Ravnborg
Hi Gerd.
Quoted 26 lines · Gerd Hoffmann
Store width and height of the bo. Needed in case userspace sets up a framebuffer with
fb->width!=bo->width..Signed-off-by Gerd Hoffmann <[email protected]>--- include/drm/drm_gem_vram_helper.h | 1 + drivers/gpu/drm/drm_gem_vram_helper.c | 2 ++ 2 files changed, 3 insertions(+)include/drm/drm_gem_vram_helper.h +1
-0@@ -39,6 +39,7 @@ struct drm_gem_vram_object {struct drm_gem_object gem;struct ttm_buffer_object bo;struct ttm_bo_kmap_obj kmap; +unsigned int width, height;/* Supported placements are %TTM_PL_VRAM and %TTM_PL_SYSTEM */ struct ttm_placement placement;drivers/gpu/drm/drm_gem_vram_helper.c +0
-0drivers/gpu/drm/drm_gem_vram_helper.c int drm_gem_vram_fill_create_dumb(struct drm_file *file, · line 384
Quoted 8 lines
drivers/gpu/drm/drm_gem_vram_helper.c +2
-0@@ -377,6 +377,8 @@ int drm_gem_vram_fill_create_dumb(struct drm_file *file, gbo =drm_gem_vram_create (dev, bdev, size, pg_align, interruptible);if (IS_ERR (gbo))return PTR_ERR (gbo); + gbo->width = args->width; + gbo->height = args->height; ret =drm_gem_handle_create (file, &gbo->gem, &handle);if (ret)Be warned, I may have missed something in the bigger picture.
Your patch will set width and height only for dumb bo's But we have several users of
drm_gem_vram_create()that will not set the width and height.
Quoted 8 lines
Quoted 4 lines
So only in some cases can we rely on them being set. Should this be refactored so we always set width, height. Or maybe say in a small comment that width,height are only set for dumb bo's?
Also for dumb bo allocated buffers if userspace gets the dimensions wrong between
dumb_createand the addfb, something is wrong. Papering over that by remembering the right dimensions doesn't look like a good solution.
Hi,
just a note irrelevant to this particular driver:
I have deliberately allocated a too high dumb buffer in userspace and created multiple smaller DRM FBs out of it with different offsets (i * 128 * stride). This has been a very useful hack to see that a GPU-less driver actually honours fences correctly, because if it doesn't, the whole image will be off by the offset delta, which is epileptically easy to see.
So I'm not getting the height wrong, I am deliberately overallocating and aliasing.
Thanks,
pq
Re: [PATCH 1/2] drm/vram: store dumb bo dimensions.
Quoted 68 lines · Pekka Paalanen
Quoted 45 lines · On Wed, 26 Jun 2019 18:27:54 +0200 Daniel Vetter <[email protected]> wrote:
Quoted 44 lines · Sam Ravnborg
Hi Gerd.
Quoted 26 lines · Gerd Hoffmann
Store width and height of the bo. Needed in case userspace sets up a framebuffer with
fb->width!=bo->width..Signed-off-by Gerd Hoffmann <[email protected]>--- include/drm/drm_gem_vram_helper.h | 1 + drivers/gpu/drm/drm_gem_vram_helper.c | 2 ++ 2 files changed, 3 insertions(+)include/drm/drm_gem_vram_helper.h +1
-0@@ -39,6 +39,7 @@ struct drm_gem_vram_object {struct drm_gem_object gem;struct ttm_buffer_object bo;struct ttm_bo_kmap_obj kmap; +unsigned int width, height;/* Supported placements are %TTM_PL_VRAM and %TTM_PL_SYSTEM */ struct ttm_placement placement;drivers/gpu/drm/drm_gem_vram_helper.c +0
-0drivers/gpu/drm/drm_gem_vram_helper.c int drm_gem_vram_fill_create_dumb(struct drm_file *file, · line 384
Quoted 8 lines
drivers/gpu/drm/drm_gem_vram_helper.c +2
-0@@ -377,6 +377,8 @@ int drm_gem_vram_fill_create_dumb(struct drm_file *file, gbo =drm_gem_vram_create (dev, bdev, size, pg_align, interruptible);if (IS_ERR (gbo))return PTR_ERR (gbo); + gbo->width = args->width; + gbo->height = args->height; ret =drm_gem_handle_create (file, &gbo->gem, &handle);if (ret)Be warned, I may have missed something in the bigger picture.
Your patch will set width and height only for dumb bo's But we have several users of
drm_gem_vram_create()that will not set the width and height.Quoted 8 lines
Quoted 4 lines
So only in some cases can we rely on them being set. Should this be refactored so we always set width, height. Or maybe say in a small comment that width,height are only set for dumb bo's?
Also for dumb bo allocated buffers if userspace gets the dimensions wrong between
dumb_createand the addfb, something is wrong. Papering over that by remembering the right dimensions doesn't look like a good solution.Hi,
just a note irrelevant to this particular driver:
I have deliberately allocated a too high dumb buffer in userspace and created multiple smaller DRM FBs out of it with different offsets (i * 128 * stride). This has been a very useful hack to see that a GPU-less driver actually honours fences correctly, because if it doesn't, the whole image will be off by the offset delta, which is epileptically easy to see.
Quoted 2 lines
So I'm not getting the height wrong, I am deliberately overallocating and aliasing.
Yeah that's the other reason for why this patch is wrong: It would break things like this trickery here :-) The separation between backing storage and drm_fb is intentional, multiple fb in one overall fb is explicitly ok. -Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch