All of lore.kernel.org
 help / color / mirror / Atom feed
From: ville.syrjala@linux.intel.com
To: dri-devel@lists.freedesktop.org
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Ben Skeggs <bskeggs@redhat.com>
Subject: [PATCH 11/32] drm/nouveau: Add local 'fb' variables
Date: Thu, 17 Nov 2016 18:14:10 +0200	[thread overview]
Message-ID: <1479399271-31991-12-git-send-email-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <1479399271-31991-1-git-send-email-ville.syrjala@linux.intel.com>

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Add a local 'fb' variable to a few places to get rid of the
'crtc->primary->fb' stuff. Looks neater and helps me with my poor
coccinelle skills later.

Cc: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/nouveau/dispnv04/crtc.c | 5 +++--
 drivers/gpu/drm/nouveau/dispnv04/dfp.c  | 3 ++-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/dispnv04/crtc.c b/drivers/gpu/drm/nouveau/dispnv04/crtc.c
index 7c6c66f177df..8286b8ffe109 100644
--- a/drivers/gpu/drm/nouveau/dispnv04/crtc.c
+++ b/drivers/gpu/drm/nouveau/dispnv04/crtc.c
@@ -460,6 +460,7 @@ nv_crtc_mode_set_regs(struct drm_crtc *crtc, struct drm_display_mode * mode)
 	struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc);
 	struct nv04_crtc_reg *regp = &nv04_display(dev)->mode_reg.crtc_reg[nv_crtc->index];
 	struct nv04_crtc_reg *savep = &nv04_display(dev)->saved_reg.crtc_reg[nv_crtc->index];
+	const struct drm_framebuffer *fb = crtc->primary->fb;
 	struct drm_encoder *encoder;
 	bool lvds_output = false, tmds_output = false, tv_output = false,
 		off_chip_digital = false;
@@ -569,7 +570,7 @@ nv_crtc_mode_set_regs(struct drm_crtc *crtc, struct drm_display_mode * mode)
 		regp->CRTC[NV_CIO_CRE_86] = 0x1;
 	}
 
-	regp->CRTC[NV_CIO_CRE_PIXEL_INDEX] = (crtc->primary->fb->depth + 1) / 8;
+	regp->CRTC[NV_CIO_CRE_PIXEL_INDEX] = (fb->depth + 1) / 8;
 	/* Enable slaved mode (called MODE_TV in nv4ref.h) */
 	if (lvds_output || tmds_output || tv_output)
 		regp->CRTC[NV_CIO_CRE_PIXEL_INDEX] |= (1 << 7);
@@ -583,7 +584,7 @@ nv_crtc_mode_set_regs(struct drm_crtc *crtc, struct drm_display_mode * mode)
 	regp->ramdac_gen_ctrl = NV_PRAMDAC_GENERAL_CONTROL_BPC_8BITS |
 				NV_PRAMDAC_GENERAL_CONTROL_VGA_STATE_SEL |
 				NV_PRAMDAC_GENERAL_CONTROL_PIXMIX_ON;
-	if (crtc->primary->fb->depth == 16)
+	if (fb->depth == 16)
 		regp->ramdac_gen_ctrl |= NV_PRAMDAC_GENERAL_CONTROL_ALT_MODE_SEL;
 	if (drm->device.info.chipset >= 0x11)
 		regp->ramdac_gen_ctrl |= NV_PRAMDAC_GENERAL_CONTROL_PIPE_LONG;
diff --git a/drivers/gpu/drm/nouveau/dispnv04/dfp.c b/drivers/gpu/drm/nouveau/dispnv04/dfp.c
index c2947ef7d4fc..945607b3cd41 100644
--- a/drivers/gpu/drm/nouveau/dispnv04/dfp.c
+++ b/drivers/gpu/drm/nouveau/dispnv04/dfp.c
@@ -290,6 +290,7 @@ static void nv04_dfp_mode_set(struct drm_encoder *encoder,
 	struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder);
 	struct drm_display_mode *output_mode = &nv_encoder->mode;
 	struct drm_connector *connector = &nv_connector->base;
+	const struct drm_framebuffer *fb = encoder->crtc->primary->fb;
 	uint32_t mode_ratio, panel_ratio;
 
 	NV_DEBUG(drm, "Output mode on CRTC %d:\n", nv_crtc->index);
@@ -415,7 +416,7 @@ static void nv04_dfp_mode_set(struct drm_encoder *encoder,
 	/* Output property. */
 	if ((nv_connector->dithering_mode == DITHERING_MODE_ON) ||
 	    (nv_connector->dithering_mode == DITHERING_MODE_AUTO &&
-	     encoder->crtc->primary->fb->depth > connector->display_info.bpc * 3)) {
+	     fb->depth > connector->display_info.bpc * 3)) {
 		if (drm->device.info.chipset == 0x11)
 			regp->dither = savep->dither | 0x00010000;
 		else {
-- 
2.7.4

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2016-11-17 16:15 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-17 16:13 [PATCH 00/32] drm: Deduplicate fb format information ville.syrjala
2016-11-17 16:14 ` [PATCH 01/32] drm/i915: Add local 'fb' variables ville.syrjala
2016-11-17 16:14 ` [PATCH 02/32] drm/radeon: " ville.syrjala
2016-11-17 17:21   ` Alex Deucher
2016-11-17 16:14 ` [PATCH 03/32] drm/radeon: Use DIV_ROUND_UP() ville.syrjala
2016-11-17 17:22   ` Alex Deucher
2016-11-17 16:14 ` [PATCH 04/32] drm/mgag200: Add local 'fb' variable ville.syrjala
2016-11-17 16:14 ` [PATCH 05/32] drm/ast: Add local 'fb' variables ville.syrjala
2016-11-17 16:14 ` [PATCH 06/32] drm/gma500: Add some " ville.syrjala
2016-11-17 16:14 ` [PATCH 07/32] drm/cirrus: " ville.syrjala
2016-11-17 16:14 ` [PATCH 08/32] drm/arcpgu: Add " ville.syrjala
2016-11-17 16:14 ` [PATCH 09/32] drm/arm: " ville.syrjala
2016-11-17 16:14 ` [PATCH 10/32] drm/nouveau: Fix crtc->primary->fb vs. drm_fb fail ville.syrjala
2016-11-17 16:14 ` ville.syrjala [this message]
2016-11-17 16:14 ` [PATCH 12/32] drm/vmwgfx: Populate fb->dev before drm_framebuffer_init() ville.syrjala
2016-11-17 16:14 ` [PATCH 13/32] drm: Pass 'dev' to drm_helper_mode_fill_fb_struct() ville.syrjala
2016-11-17 17:41   ` Laurent Pinchart
2016-11-17 16:14 ` [PATCH 14/32] drm/vmwgfx: Populate fb->pixel_format ville.syrjala
2016-11-17 17:52   ` Laurent Pinchart
2016-11-17 19:27     ` Ville Syrjälä
2016-11-17 16:14 ` [PATCH 15/32] drm/qxl: Call drm_helper_mode_fill_fb_struct() before drm_framebuffer_init() ville.syrjala
2016-11-17 16:14 ` [PATCH 16/32] drm/virtio: " ville.syrjala
2016-11-17 16:14 ` [PATCH 17/32] drm/i915: Set fb->dev early on for inherited fbs ville.syrjala
2016-11-17 16:14 ` [PATCH 18/32] drm: Populate fb->dev from drm_helper_mode_fill_fb_struct() ville.syrjala
2016-11-17 17:43   ` Laurent Pinchart
2016-11-17 16:14 ` [PATCH 19/32] drm: Store a pointer to drm_format_info under drm_framebuffer ville.syrjala
2016-11-17 17:57   ` Laurent Pinchart
2016-11-17 18:06     ` Ville Syrjälä
2016-11-17 18:13       ` Ville Syrjälä
2016-11-17 18:16         ` Laurent Pinchart
2016-11-17 16:14 ` [PATCH 20/32] drm/vmwgfx: Populate fb->format correctly ville.syrjala
2016-11-17 16:14 ` [PATCH 21/32] drm/i915: Populate fb->format early for inherited fbs ville.syrjala
2016-11-17 16:14 ` [PATCH 22/32] drm/atomic: Replace drm_format_num_planes() with fb->format->num_planes ville.syrjala
2016-11-17 17:58   ` Laurent Pinchart
2016-11-17 16:14 ` [PATCH 23/32] drm/fb_cma_helper: Replace drm_format_info() with fb->format ville.syrjala
2016-11-17 17:58   ` Laurent Pinchart
2016-11-17 16:14 ` [PATCH 24/32] drm/nouveau: Use fb->format rather than drm_format_info() ville.syrjala
2016-11-17 16:14 ` [PATCH 25/32] drm/i915: Store a pointer to the pixel format info for fbc ville.syrjala
2016-11-17 16:14 ` [PATCH 26/32] drm/i915: Replace drm_format_plane_cpp() with fb->format->cpp[] ville.syrjala
2016-11-17 16:14 ` [PATCH 27/32] drm/i915: Replace drm_format_num_planes() with fb->format->num_planes ville.syrjala
2016-11-17 16:14 ` [PATCH 28/32] drm: Add drm_framebuffer_plane_{width,height}() ville.syrjala
2016-11-17 16:14 ` [PATCH 29/32] drm/i915: Use drm_framebuffer_plane_{width, height}() where possible ville.syrjala
2016-11-17 16:14 ` [PATCH 30/32] drm: Nuke fb->depth ville.syrjala
2016-11-17 18:03   ` Laurent Pinchart
2016-11-17 16:14 ` [PATCH 31/32] drm: Nuke fb->bits_per_pixel ville.syrjala
2016-11-17 18:14   ` Laurent Pinchart
2016-11-17 18:35     ` Ville Syrjälä
2016-11-17 18:41       ` Laurent Pinchart
2016-11-17 19:18   ` [PATCH v2 " ville.syrjala
2016-11-17 16:14 ` [PATCH 32/32] drm: Nuke fb->pixel_format ville.syrjala
2016-11-17 17:37   ` Alex Deucher
2016-11-17 18:39   ` Laurent Pinchart

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1479399271-31991-12-git-send-email-ville.syrjala@linux.intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=bskeggs@redhat.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=laurent.pinchart@ideasonboard.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.