Skip to content

Commit

Permalink
Merge tag 'drm-misc-next-2019-03-28-1' of git://anongit.freedesktop.o…
Browse files Browse the repository at this point in the history
…rg/drm/drm-misc into drm-next

drm-misc-next for 5.2:

UAPI Changes:
- Remove unused DRM_DISPLAY_INFO_LEN (Ville)

Cross-subsystem Changes:
- None

Core Changes:
- Fix compilation when CONFIG_FBDEV not selected (Daniel)
- fbdev: Make skip_vt_switch default (Daniel)
- Merge fb_helper_fill_fix, fb_helper_fill_var into fb_helper_fill_info (Daniel)
- Remove unused fields in connector, display_info, and edid_quirks (Ville)

Driver Changes:
- virtio: package function args in virtio_gpu_object_params (Gerd)
- vkms: Fix potential NULL-dereference bug (Kangjie)

Signed-off-by: Dave Airlie <airlied@redhat.com>

From: Sean Paul <sean@poorly.run>
Link: https://patchwork.freedesktop.org/patch/msgid/20190328183045.GA44823@art_vandelay
  • Loading branch information
Dave Airlie committed Mar 29, 2019
2 parents 2337091 + 530b284 commit b4e4538
Show file tree
Hide file tree
Showing 46 changed files with 292 additions and 442 deletions.
1 change: 0 additions & 1 deletion Documentation/gpu/kms-properties.csv
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ Owner Module/Drivers,Group,Property Name,Type,Property Values,Object attached,De
,Virtual GPU,“suggested X”,RANGE,"Min=0, Max=0xffffffff",Connector,property to suggest an X offset for a connector
,,“suggested Y”,RANGE,"Min=0, Max=0xffffffff",Connector,property to suggest an Y offset for a connector
,Optional,"""aspect ratio""",ENUM,"{ ""None"", ""4:3"", ""16:9"" }",Connector,TDB
,Optional,"""content type""",ENUM,"{ ""No Data"", ""Graphics"", ""Photo"", ""Cinema"", ""Game"" }",Connector,TBD
i915,Generic,"""Broadcast RGB""",ENUM,"{ ""Automatic"", ""Full"", ""Limited 16:235"" }",Connector,"When this property is set to Limited 16:235 and CTM is set, the hardware will be programmed with the result of the multiplication of CTM by the limited range matrix to ensure the pixels normaly in the range 0..1.0 are remapped to the range 16/255..235/255."
,,“audio”,ENUM,"{ ""force-dvi"", ""off"", ""auto"", ""on"" }",Connector,TBD
,SDVO-TV,“mode”,ENUM,"{ ""NTSC_M"", ""NTSC_J"", ""NTSC_443"", ""PAL_B"" } etc.",Connector,TBD
Expand Down
25 changes: 8 additions & 17 deletions drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,11 @@
static int
amdgpufb_open(struct fb_info *info, int user)
{
struct amdgpu_fbdev *rfbdev = info->par;
struct amdgpu_device *adev = rfbdev->adev;
int ret = pm_runtime_get_sync(adev->ddev->dev);
struct drm_fb_helper *fb_helper = info->par;
int ret = pm_runtime_get_sync(fb_helper->dev->dev);
if (ret < 0 && ret != -EACCES) {
pm_runtime_mark_last_busy(adev->ddev->dev);
pm_runtime_put_autosuspend(adev->ddev->dev);
pm_runtime_mark_last_busy(fb_helper->dev->dev);
pm_runtime_put_autosuspend(fb_helper->dev->dev);
return ret;
}
return 0;
Expand All @@ -63,11 +62,10 @@ amdgpufb_open(struct fb_info *info, int user)
static int
amdgpufb_release(struct fb_info *info, int user)
{
struct amdgpu_fbdev *rfbdev = info->par;
struct amdgpu_device *adev = rfbdev->adev;
struct drm_fb_helper *fb_helper = info->par;

pm_runtime_mark_last_busy(adev->ddev->dev);
pm_runtime_put_autosuspend(adev->ddev->dev);
pm_runtime_mark_last_busy(fb_helper->dev->dev);
pm_runtime_put_autosuspend(fb_helper->dev->dev);
return 0;
}

Expand Down Expand Up @@ -233,9 +231,6 @@ static int amdgpufb_create(struct drm_fb_helper *helper,
goto out;
}

info->par = rfbdev;
info->skip_vt_switch = true;

ret = amdgpu_display_framebuffer_init(adev->ddev, &rfbdev->rfb,
&mode_cmd, gobj);
if (ret) {
Expand All @@ -248,10 +243,6 @@ static int amdgpufb_create(struct drm_fb_helper *helper,
/* setup helper */
rfbdev->helper.fb = fb;

strcpy(info->fix.id, "amdgpudrmfb");

drm_fb_helper_fill_fix(info, fb->pitches[0], fb->format->depth);

info->fbops = &amdgpufb_ops;

tmp = amdgpu_bo_gpu_offset(abo) - adev->gmc.vram_start;
Expand All @@ -260,7 +251,7 @@ static int amdgpufb_create(struct drm_fb_helper *helper,
info->screen_base = amdgpu_bo_kptr(abo);
info->screen_size = amdgpu_bo_size(abo);

drm_fb_helper_fill_var(info, &rfbdev->helper, sizes->fb_width, sizes->fb_height);
drm_fb_helper_fill_info(info, &rfbdev->helper, sizes);

/* setup aperture base/size for vesafb takeover */
info->apertures->ranges[0].base = adev->ddev->mode_config.fb_base;
Expand Down
6 changes: 1 addition & 5 deletions drivers/gpu/drm/armada/armada_fbdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,18 +78,14 @@ static int armada_fbdev_create(struct drm_fb_helper *fbh,
goto err_fballoc;
}

strlcpy(info->fix.id, "armada-drmfb", sizeof(info->fix.id));
info->par = fbh;
info->fbops = &armada_fb_ops;
info->fix.smem_start = obj->phys_addr;
info->fix.smem_len = obj->obj.size;
info->screen_size = obj->obj.size;
info->screen_base = ptr;
fbh->fb = &dfb->fb;

drm_fb_helper_fill_fix(info, dfb->fb.pitches[0],
dfb->fb.format->depth);
drm_fb_helper_fill_var(info, fbh, sizes->fb_width, sizes->fb_height);
drm_fb_helper_fill_info(info, fbh, sizes);

DRM_DEBUG_KMS("allocated %dx%d %dbpp fb: 0x%08llx\n",
dfb->fb.width, dfb->fb.height, dfb->fb.format->cpp[0] * 8,
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/ast/ast_drv.h
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ struct ast_framebuffer {
};

struct ast_fbdev {
struct drm_fb_helper helper;
struct drm_fb_helper helper; /* must be first */
struct ast_framebuffer afb;
void *sysram;
int size;
Expand Down
7 changes: 1 addition & 6 deletions drivers/gpu/drm/ast/ast_fb.c
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,6 @@ static int astfb_create(struct drm_fb_helper *helper,
ret = PTR_ERR(info);
goto out;
}
info->par = afbdev;

ret = ast_framebuffer_init(dev, &afbdev->afb, &mode_cmd, gobj);
if (ret)
goto out;
Expand All @@ -229,15 +227,12 @@ static int astfb_create(struct drm_fb_helper *helper,
fb = &afbdev->afb.base;
afbdev->helper.fb = fb;

strcpy(info->fix.id, "astdrmfb");

info->fbops = &astfb_ops;

info->apertures->ranges[0].base = pci_resource_start(dev->pdev, 0);
info->apertures->ranges[0].size = pci_resource_len(dev->pdev, 0);

drm_fb_helper_fill_fix(info, fb->pitches[0], fb->format->depth);
drm_fb_helper_fill_var(info, &afbdev->helper, sizes->fb_width, sizes->fb_height);
drm_fb_helper_fill_info(info, &afbdev->helper, sizes);

info->screen_base = sysram;
info->screen_size = size;
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/cirrus/cirrus_drv.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ struct cirrus_device {


struct cirrus_fbdev {
struct drm_fb_helper helper;
struct drm_fb_helper helper; /* must be first */
struct drm_framebuffer *gfb;
void *sysram;
int size;
Expand Down
8 changes: 1 addition & 7 deletions drivers/gpu/drm/cirrus/cirrus_fbdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,6 @@ static int cirrusfb_create(struct drm_fb_helper *helper,
goto err_vfree;
}

info->par = gfbdev;

fb = kzalloc(sizeof(*fb), GFP_KERNEL);
if (!fb) {
ret = -ENOMEM;
Expand All @@ -214,13 +212,9 @@ static int cirrusfb_create(struct drm_fb_helper *helper,
/* setup helper */
gfbdev->helper.fb = fb;

strcpy(info->fix.id, "cirrusdrmfb");

info->fbops = &cirrusfb_ops;

drm_fb_helper_fill_fix(info, fb->pitches[0], fb->format->depth);
drm_fb_helper_fill_var(info, &gfbdev->helper, sizes->fb_width,
sizes->fb_height);
drm_fb_helper_fill_info(info, &gfbdev->helper, sizes);

/* setup aperture base/size for vesafb takeover */
info->apertures->ranges[0].base = cdev->dev->mode_config.fb_base;
Expand Down
10 changes: 0 additions & 10 deletions drivers/gpu/drm/drm_edid.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,6 @@
* maximum size and use that.
*/
#define EDID_QUIRK_DETAILED_USE_MAXIMUM_SIZE (1 << 4)
/* Monitor forgot to set the first detailed is preferred bit. */
#define EDID_QUIRK_FIRST_DETAILED_PREFERRED (1 << 5)
/* use +hsync +vsync for detailed mode */
#define EDID_QUIRK_DETAILED_SYNC_PP (1 << 6)
/* Force reduced-blanking timings for detailed modes */
Expand Down Expand Up @@ -107,8 +105,6 @@ static const struct edid_quirk {
{ "ACR", 44358, EDID_QUIRK_PREFER_LARGE_60 },
/* Acer F51 */
{ "API", 0x7602, EDID_QUIRK_PREFER_LARGE_60 },
/* Unknown Acer */
{ "ACR", 2423, EDID_QUIRK_FIRST_DETAILED_PREFERRED },

/* AEO model 0 reports 8 bpc, but is a 6 bpc panel */
{ "AEO", 0, EDID_QUIRK_FORCE_6BPC },
Expand Down Expand Up @@ -145,12 +141,6 @@ static const struct edid_quirk {
{ "LPL", 0, EDID_QUIRK_DETAILED_USE_MAXIMUM_SIZE },
{ "LPL", 0x2a00, EDID_QUIRK_DETAILED_USE_MAXIMUM_SIZE },

/* Philips 107p5 CRT */
{ "PHL", 57364, EDID_QUIRK_FIRST_DETAILED_PREFERRED },

/* Proview AY765C */
{ "PTS", 765, EDID_QUIRK_FIRST_DETAILED_PREFERRED },

/* Samsung SyncMaster 205BW. Note: irony */
{ "SAM", 541, EDID_QUIRK_DETAILED_SYNC_PP },
/* Samsung SyncMaster 22[5-6]BW */
Expand Down
80 changes: 39 additions & 41 deletions drivers/gpu/drm/drm_fb_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -934,6 +934,7 @@ struct fb_info *drm_fb_helper_alloc_fbi(struct drm_fb_helper *fb_helper)
}

fb_helper->fbdev = info;
info->skip_vt_switch = true;

return info;

Expand Down Expand Up @@ -2036,21 +2037,8 @@ static int drm_fb_helper_single_fb_probe(struct drm_fb_helper *fb_helper,
return 0;
}

/**
* drm_fb_helper_fill_fix - initializes fixed fbdev information
* @info: fbdev registered by the helper
* @pitch: desired pitch
* @depth: desired depth
*
* Helper to fill in the fixed fbdev information useful for a non-accelerated
* fbdev emulations. Drivers which support acceleration methods which impose
* additional constraints need to set up their own limits.
*
* Drivers should call this (or their equivalent setup code) from their
* &drm_fb_helper_funcs.fb_probe callback.
*/
void drm_fb_helper_fill_fix(struct fb_info *info, uint32_t pitch,
uint32_t depth)
static void drm_fb_helper_fill_fix(struct fb_info *info, uint32_t pitch,
uint32_t depth)
{
info->fix.type = FB_TYPE_PACKED_PIXELS;
info->fix.visual = depth == 8 ? FB_VISUAL_PSEUDOCOLOR :
Expand All @@ -2065,24 +2053,10 @@ void drm_fb_helper_fill_fix(struct fb_info *info, uint32_t pitch,

info->fix.line_length = pitch;
}
EXPORT_SYMBOL(drm_fb_helper_fill_fix);

/**
* drm_fb_helper_fill_var - initalizes variable fbdev information
* @info: fbdev instance to set up
* @fb_helper: fb helper instance to use as template
* @fb_width: desired fb width
* @fb_height: desired fb height
*
* Sets up the variable fbdev metainformation from the given fb helper instance
* and the drm framebuffer allocated in &drm_fb_helper.fb.
*
* Drivers should call this (or their equivalent setup code) from their
* &drm_fb_helper_funcs.fb_probe callback after having allocated the fbdev
* backing storage framebuffer.
*/
void drm_fb_helper_fill_var(struct fb_info *info, struct drm_fb_helper *fb_helper,
uint32_t fb_width, uint32_t fb_height)
static void drm_fb_helper_fill_var(struct fb_info *info,
struct drm_fb_helper *fb_helper,
uint32_t fb_width, uint32_t fb_height)
{
struct drm_framebuffer *fb = fb_helper->fb;

Expand All @@ -2102,7 +2076,36 @@ void drm_fb_helper_fill_var(struct fb_info *info, struct drm_fb_helper *fb_helpe
info->var.xres = fb_width;
info->var.yres = fb_height;
}
EXPORT_SYMBOL(drm_fb_helper_fill_var);

/**
* drm_fb_helper_fill_info - initializes fbdev information
* @info: fbdev instance to set up
* @fb_helper: fb helper instance to use as template
* @sizes: describes fbdev size and scanout surface size
*
* Sets up the variable and fixed fbdev metainformation from the given fb helper
* instance and the drm framebuffer allocated in &drm_fb_helper.fb.
*
* Drivers should call this (or their equivalent setup code) from their
* &drm_fb_helper_funcs.fb_probe callback after having allocated the fbdev
* backing storage framebuffer.
*/
void drm_fb_helper_fill_info(struct fb_info *info,
struct drm_fb_helper *fb_helper,
struct drm_fb_helper_surface_size *sizes)
{
struct drm_framebuffer *fb = fb_helper->fb;

drm_fb_helper_fill_fix(info, fb->pitches[0], fb->format->depth);
drm_fb_helper_fill_var(info, fb_helper,
sizes->fb_width, sizes->fb_height);

info->par = fb_helper;
snprintf(info->fix.id, sizeof(info->fix.id), "%sdrmfb",
fb_helper->dev->driver->name);

}
EXPORT_SYMBOL(drm_fb_helper_fill_info);

static int drm_fb_helper_probe_connector_modes(struct drm_fb_helper *fb_helper,
uint32_t maxX,
Expand Down Expand Up @@ -2780,9 +2783,8 @@ __drm_fb_helper_initial_config_and_unlock(struct drm_fb_helper *fb_helper,
*
* This function will call down into the &drm_fb_helper_funcs.fb_probe callback
* to let the driver allocate and initialize the fbdev info structure and the
* drm framebuffer used to back the fbdev. drm_fb_helper_fill_var() and
* drm_fb_helper_fill_fix() are provided as helpers to setup simple default
* values for the fbdev info structure.
* drm framebuffer used to back the fbdev. drm_fb_helper_fill_info() is provided
* as a helper to setup simple default values for the fbdev info structure.
*
* HANG DEBUGGING:
*
Expand Down Expand Up @@ -3151,7 +3153,6 @@ int drm_fb_helper_generic_probe(struct drm_fb_helper *fb_helper,
if (IS_ERR(fbi))
return PTR_ERR(fbi);

fbi->par = fb_helper;
fbi->fbops = &drm_fbdev_fb_ops;
fbi->screen_size = fb->height * fb->pitches[0];
fbi->fix.smem_len = fbi->screen_size;
Expand All @@ -3162,10 +3163,7 @@ int drm_fb_helper_generic_probe(struct drm_fb_helper *fb_helper,
fbi->fix.smem_start =
page_to_phys(virt_to_page(fbi->screen_buffer));
#endif
strcpy(fbi->fix.id, "DRM emulated");

drm_fb_helper_fill_fix(fbi, fb->pitches[0], fb->format->depth);
drm_fb_helper_fill_var(fbi, fb_helper, sizes->fb_width, sizes->fb_height);
drm_fb_helper_fill_info(fbi, fb_helper, sizes);

if (fb->funcs->dirty) {
struct fb_ops *fbops;
Expand Down
4 changes: 1 addition & 3 deletions drivers/gpu/drm/exynos/exynos_drm_fbdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,9 @@ static int exynos_drm_fbdev_update(struct drm_fb_helper *helper,
return PTR_ERR(fbi);
}

fbi->par = helper;
fbi->fbops = &exynos_drm_fb_ops;

drm_fb_helper_fill_fix(fbi, fb->pitches[0], fb->format->depth);
drm_fb_helper_fill_var(fbi, helper, sizes->fb_width, sizes->fb_height);
drm_fb_helper_fill_info(fbi, helper, sizes);

nr_pages = exynos_gem->size >> PAGE_SHIFT;

Expand Down
7 changes: 1 addition & 6 deletions drivers/gpu/drm/gma500/framebuffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,6 @@ static int psbfb_create(struct psb_fbdev *fbdev,
ret = PTR_ERR(info);
goto out;
}
info->par = fbdev;

mode_cmd.pixel_format = drm_mode_legacy_fb_format(bpp, depth);

Expand All @@ -402,9 +401,6 @@ static int psbfb_create(struct psb_fbdev *fbdev,

fbdev->psb_fb_helper.fb = fb;

drm_fb_helper_fill_fix(info, fb->pitches[0], fb->format->depth);
strcpy(info->fix.id, "psbdrmfb");

if (dev_priv->ops->accel_2d && pitch_lines > 8) /* 2D engine */
info->fbops = &psbfb_ops;
else if (gtt_roll) { /* GTT rolling seems best */
Expand All @@ -427,8 +423,7 @@ static int psbfb_create(struct psb_fbdev *fbdev,
info->apertures->ranges[0].size = dev_priv->gtt.stolen_size;
}

drm_fb_helper_fill_var(info, &fbdev->psb_fb_helper,
sizes->fb_width, sizes->fb_height);
drm_fb_helper_fill_info(info, &fbdev->psb_fb_helper, sizes);

info->fix.mmio_start = pci_resource_start(dev->pdev, 0);
info->fix.mmio_len = pci_resource_len(dev->pdev, 0);
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/gma500/framebuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ struct psb_framebuffer {
};

struct psb_fbdev {
struct drm_fb_helper psb_fb_helper;
struct drm_fb_helper psb_fb_helper; /* must be first */
struct psb_framebuffer pfb;
};

Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ struct hibmc_framebuffer {
};

struct hibmc_fbdev {
struct drm_fb_helper helper;
struct drm_fb_helper helper; /* must be first */
struct hibmc_framebuffer *fb;
int size;
};
Expand Down
Loading

0 comments on commit b4e4538

Please sign in to comment.