[PATCH 0/8] drm/bochs: convert bochs to atomic mode-setting

2016-03-04 Thread John Hunter
Hi Gerd,

Sorry about that, but I am now busy with my master's degree stuffs.

Really can't spare any time on this until maybe July.

On Thu, Mar 3, 2016 at 5:28 PM, Gerd Hoffmann  wrote:

>   Hi,
>
> > > Did testing a while back & reported back to John (not sure this was in
> > > public on the list as we had some ping-ping emails beforehand due to
> > > some problems of applying the patches).  No new version of the series
> > > since.
> > >
> > The only comment that I can see is this one [1] which was addressed a
> > couple of days later [2].
> > If you have any other comments please bring them up publicly.
>
> Digged the mails up in the archive.
>
> First, v2 posting was apparently incomplete, only one of the 8 patches
> landed in my inbox.
>
> John pointed me to
> https://github.com/zhjwpku/gsoc/commits/20150720_no_gpu_addr which I've
> used to test things.
>
> Second, page flipping failed in testing.
>
> cheers,
>   Gerd
>
>
-- next part --
An HTML attachment was scrubbed...
URL: 



[Action requested] GSoC 2015: Thanks for your participation!

2015-08-23 Thread John Hunter
Hi Martin,
Here is my blog post of my current situation http://zhjwpku.blogspot.com/

Cheers,
Zhao

On Sat, Aug 22, 2015 at 3:52 AM, Martin Peres  wrote:

> Hello everyone,
>
> Today is the official pencil down date so it is a good time for me to
> congratulate everyone for their participation!
>
> On the administrative side, I need all the students to write a blog post
> to explain the current situation of their project  (What was done, what's
> left, what you learnt, your difficulties, etc..) and send it to the mailing
> list of your project with me in CC. I would also like to ask you again if
> you are willing to attend the X.Org Developer Conference to talk about your
> project [0]. If so, please submit as soon as possible (this week end!) your
> proposal along with your expected travel and hotel expenses to the xorg
> board of director.
> I also need both mentors and students to submit their respective
> evaluation forms!
>
> Even if the GSoC is now over, it does not mean that you have to cease
> contributing. Either by polishing your project or by picking up another
> project.
>
> Thanks again for your participation!
>
> Martin, on behalf of the board of directors of the X.Org Foundation
>
> [0] http://www.x.org/wiki/Events/XDC2015/
>



-- 
Best regards
Junwang Zhao
Microprocessor Research and Develop Center
Department of Computer Science 
Peking University
Beijing, 100871, PRC
-- next part --
An HTML attachment was scrubbed...
URL: 



[PATCH 7/7] drm/cirrus: add DRIVER_ATOMIC to .driver_features

2015-08-05 Thread John Hunter
From: Zhao Junwang 

Since  driver is now fully atomic, we should add DRIVER_ATOMIC to
.driver_features

Cc: Daniel Vetter 
Cc: Gerd Hoffmann 
Cc: Matthew Garrett 
Cc: Dave Airlie 
Signed-off-by: Zhao Junwang 
---
 drivers/gpu/drm/cirrus/cirrus_drv.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/cirrus/cirrus_drv.c 
b/drivers/gpu/drm/cirrus/cirrus_drv.c
index 80f1cd2..742647b 100644
--- a/drivers/gpu/drm/cirrus/cirrus_drv.c
+++ b/drivers/gpu/drm/cirrus/cirrus_drv.c
@@ -130,7 +130,7 @@ static const struct file_operations cirrus_driver_fops = {
 #endif
 };
 static struct drm_driver driver = {
-   .driver_features = DRIVER_MODESET | DRIVER_GEM,
+   .driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_ATOMIC,
.load = cirrus_driver_load,
.unload = cirrus_driver_unload,
.set_busid = drm_pci_set_busid,
-- 
1.7.10.4




[PATCH 6/7] drm/cirrus: atomic dpms support

2015-08-05 Thread John Hunter
From: Zhao Junwang 

Run dpms operations through the atomic interfaces. This basically
removes the .dpms() callback from encoders and crtcs and use .disable
and .enable to turn the crtc on and off.

use drm_atomic_helper_connector_dpms for connector

Cc: Daniel Vetter 
Cc: Gerd Hoffmann 
Cc: Matthew Garrett 
Cc: Dave Airlie 
Signed-off-by: Zhao Junwang 
---
 drivers/gpu/drm/cirrus/cirrus_mode.c |   68 +++---
 1 file changed, 39 insertions(+), 29 deletions(-)

diff --git a/drivers/gpu/drm/cirrus/cirrus_mode.c 
b/drivers/gpu/drm/cirrus/cirrus_mode.c
index 1775864..e807cf0 100644
--- a/drivers/gpu/drm/cirrus/cirrus_mode.c
+++ b/drivers/gpu/drm/cirrus/cirrus_mode.c
@@ -55,37 +55,40 @@ static void cirrus_crtc_load_lut(struct drm_crtc *crtc)
}
 }

-/*
- * The DRM core requires DPMS functions, but they make little sense in our
- * case and so are just stubs
- */
+static void cirrus_crtc_enable(struct drm_crtc *crtc)
+{
+   struct drm_device *dev = crtc->dev;
+   struct cirrus_device *cdev = dev->dev_private;
+   u8 sr01, gr0e;
+
+   if (crtc->enabled)
+   return;

-static void cirrus_crtc_dpms(struct drm_crtc *crtc, int mode)
+   sr01 = 0x00;
+   gr0e = 0x00;
+
+   WREG8(SEQ_INDEX, 0x1);
+   sr01 |= RREG8(SEQ_DATA) & ~0x20;
+   WREG_SEQ(0x1, sr01);
+
+   WREG8(GFX_INDEX, 0xe);
+   gr0e |= RREG8(GFX_DATA) & ~0x06;
+   WREG_GFX(0xe, gr0e);
+
+   crtc->enabled = true;
+}
+
+static void cirrus_crtc_disable(struct drm_crtc *crtc)
 {
struct drm_device *dev = crtc->dev;
struct cirrus_device *cdev = dev->dev_private;
u8 sr01, gr0e;

-   switch (mode) {
-   case DRM_MODE_DPMS_ON:
-   sr01 = 0x00;
-   gr0e = 0x00;
-   break;
-   case DRM_MODE_DPMS_STANDBY:
-   sr01 = 0x20;
-   gr0e = 0x02;
-   break;
-   case DRM_MODE_DPMS_SUSPEND:
-   sr01 = 0x20;
-   gr0e = 0x04;
-   break;
-   case DRM_MODE_DPMS_OFF:
-   sr01 = 0x20;
-   gr0e = 0x06;
-   break;
-   default:
+   if (!crtc->enabled)
return;
-   }
+
+   sr01 = 0x20;
+   gr0e = 0x06;

WREG8(SEQ_INDEX, 0x1);
sr01 |= RREG8(SEQ_DATA) & ~0x20;
@@ -94,6 +97,8 @@ static void cirrus_crtc_dpms(struct drm_crtc *crtc, int mode)
WREG8(GFX_INDEX, 0xe);
gr0e |= RREG8(GFX_DATA) & ~0x06;
WREG_GFX(0xe, gr0e);
+
+   crtc->enabled = false;
 }

 /*
@@ -303,7 +308,8 @@ static const struct drm_crtc_funcs cirrus_crtc_funcs = {
 };

 static const struct drm_crtc_helper_funcs cirrus_helper_funcs = {
-   .dpms = cirrus_crtc_dpms,
+   .disable = cirrus_crtc_disable,
+   .enable = cirrus_crtc_enable,
.mode_fixup = cirrus_crtc_mode_fixup,
.mode_set_nofb = cirrus_crtc_mode_set_nofb,
.commit = cirrus_crtc_commit,
@@ -490,9 +496,12 @@ static void cirrus_encoder_mode_set(struct drm_encoder 
*encoder,
 {
 }

-static void cirrus_encoder_dpms(struct drm_encoder *encoder, int state)
+static void cirrus_encoder_enable(struct drm_encoder *encoder)
+{
+}
+
+static void cirrus_encoder_disable(struct drm_encoder *encoder)
 {
-   return;
 }

 static void cirrus_encoder_commit(struct drm_encoder *encoder)
@@ -507,7 +516,8 @@ static void cirrus_encoder_destroy(struct drm_encoder 
*encoder)
 }

 static const struct drm_encoder_helper_funcs cirrus_encoder_helper_funcs = {
-   .dpms = cirrus_encoder_dpms,
+   .enable = cirrus_encoder_enable,
+   .disable = cirrus_encoder_disable,
.mode_fixup = cirrus_encoder_mode_fixup,
.mode_set = cirrus_encoder_mode_set,
.commit = cirrus_encoder_commit,
@@ -580,7 +590,7 @@ struct drm_connector_helper_funcs 
cirrus_vga_connector_helper_funcs = {
 };

 struct drm_connector_funcs cirrus_vga_connector_funcs = {
-   .dpms = drm_helper_connector_dpms,
+   .dpms = drm_atomic_helper_connector_dpms,
.detect = cirrus_vga_detect,
.fill_modes = drm_helper_probe_single_connector_modes,
.destroy = cirrus_connector_destroy,
-- 
1.7.10.4




[PATCH 5/7] drm/cirrus: phase 3: use atomic .set_config helper

2015-08-05 Thread John Hunter
From: Zhao Junwang 

Now that phase 1 and phase 2 are completed, switch .set_config
helper to use the atomic one.

-stop looking legacy crtc->primary->fb, instead we should use
crtc->primary->state->fb

.prepare() calls are no more needed, remove them
.mode_set() and .mode_set_base are no longer needed, remove

Cc: Daniel Vetter 
Cc: Gerd Hoffmann 
Cc: Matthew Garrett 
Cc: Dave Airlie 
Signed-off-by: Zhao Junwang 
---
 drivers/gpu/drm/cirrus/cirrus_mode.c |   28 ++--
 1 file changed, 6 insertions(+), 22 deletions(-)

diff --git a/drivers/gpu/drm/cirrus/cirrus_mode.c 
b/drivers/gpu/drm/cirrus/cirrus_mode.c
index e8f038b..1775864 100644
--- a/drivers/gpu/drm/cirrus/cirrus_mode.c
+++ b/drivers/gpu/drm/cirrus/cirrus_mode.c
@@ -208,7 +208,8 @@ static void cirrus_crtc_mode_set_nofb(struct drm_crtc *crtc)
sr07 = RREG8(SEQ_DATA);
sr07 &= 0xe0;
hdr = 0;
-   switch (crtc->primary->fb->bits_per_pixel) {
+
+   switch (crtc->primary->state->fb->bits_per_pixel) {
case 8:
sr07 |= 0x11;
break;
@@ -231,13 +232,13 @@ static void cirrus_crtc_mode_set_nofb(struct drm_crtc 
*crtc)
WREG_SEQ(0x7, sr07);

/* Program the pitch */
-   tmp = crtc->primary->fb->pitches[0] / 8;
+   tmp = crtc->primary->state->fb->pitches[0] / 8;
WREG_CRT(VGA_CRTC_OFFSET, tmp);

/* Enable extended blanking and pitch bits, and enable full memory */
tmp = 0x22;
-   tmp |= (crtc->primary->fb->pitches[0] >> 7) & 0x10;
-   tmp |= (crtc->primary->fb->pitches[0] >> 6) & 0x40;
+   tmp |= (crtc->primary->state->fb->pitches[0] >> 7) & 0x10;
+   tmp |= (crtc->primary->state->fb->pitches[0] >> 6) & 0x40;
WREG_CRT(0x1b, tmp);

/* Enable high-colour modes */
@@ -253,15 +254,6 @@ static void cirrus_crtc_mode_set_nofb(struct drm_crtc 
*crtc)
 }

 /*
- * This is called before a mode is programmed. A typical use might be to
- * enable DPMS during the programming to avoid seeing intermediate stages,
- * but that's not relevant to us
- */
-static void cirrus_crtc_prepare(struct drm_crtc *crtc)
-{
-}
-
-/*
  * This is called after a mode is programmed. It should reverse anything done
  * by the prepare function
  */
@@ -303,7 +295,7 @@ static void cirrus_crtc_destroy(struct drm_crtc *crtc)
 /* These provide the minimum set of functions required to handle a CRTC */
 static const struct drm_crtc_funcs cirrus_crtc_funcs = {
.gamma_set = cirrus_crtc_gamma_set,
-   .set_config = drm_crtc_helper_set_config,
+   .set_config = drm_atomic_helper_set_config,
.destroy = cirrus_crtc_destroy,
.reset = drm_atomic_helper_crtc_reset,
.atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state,
@@ -313,10 +305,7 @@ static const struct drm_crtc_funcs cirrus_crtc_funcs = {
 static const struct drm_crtc_helper_funcs cirrus_helper_funcs = {
.dpms = cirrus_crtc_dpms,
.mode_fixup = cirrus_crtc_mode_fixup,
-   .mode_set = drm_helper_crtc_mode_set,
-   .mode_set_base = drm_helper_crtc_mode_set_base,
.mode_set_nofb = cirrus_crtc_mode_set_nofb,
-   .prepare = cirrus_crtc_prepare,
.commit = cirrus_crtc_commit,
.load_lut = cirrus_crtc_load_lut,
 };
@@ -506,10 +495,6 @@ static void cirrus_encoder_dpms(struct drm_encoder 
*encoder, int state)
return;
 }

-static void cirrus_encoder_prepare(struct drm_encoder *encoder)
-{
-}
-
 static void cirrus_encoder_commit(struct drm_encoder *encoder)
 {
 }
@@ -525,7 +510,6 @@ static const struct drm_encoder_helper_funcs 
cirrus_encoder_helper_funcs = {
.dpms = cirrus_encoder_dpms,
.mode_fixup = cirrus_encoder_mode_fixup,
.mode_set = cirrus_encoder_mode_set,
-   .prepare = cirrus_encoder_prepare,
.commit = cirrus_encoder_commit,
 };

-- 
1.7.10.4




[PATCH 4/7] drm/cirrus: add return 0 to make sure if (bo->pin_count) early_exit

2015-08-05 Thread John Hunter
From: Zhao Junwang 

when the first modeset calls prepare_fb, bo->pin_count change from
0 to 1, then the second modeset with the same fb, that should set
bo->pin_count to 2, and then when cleanup_fb was called, bo->pin_count
should be 2 to 1.

But in the cirrus_bo_pin, it will set bo->pin_count = 1 at the end
of the function, this results that bo->bin_count will never be larger
than 1 no matter how many times cirrus_bo_pin was called.

So we need to add a condition before bo->pin_count = 1

V2: if (bo->pin_count) early_exit; do_the_real_pinning work

Cc: Daniel Vetter 
Cc: Gerd Hoffmann 
Cc: Matthew Garrett 
Cc: Dave Airlie 
Signed-off-by: Zhao Junwang 
---
 drivers/gpu/drm/cirrus/cirrus_ttm.c |2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/cirrus/cirrus_ttm.c 
b/drivers/gpu/drm/cirrus/cirrus_ttm.c
index dfffd52..756b6d0 100644
--- a/drivers/gpu/drm/cirrus/cirrus_ttm.c
+++ b/drivers/gpu/drm/cirrus/cirrus_ttm.c
@@ -364,6 +364,8 @@ int cirrus_bo_pin(struct cirrus_bo *bo, u32 pl_flag, u64 
*gpu_addr)
bo->pin_count++;
if (gpu_addr)
*gpu_addr = cirrus_bo_gpu_offset(bo);
+
+   return 0;
}

cirrus_ttm_placement(bo, pl_flag);
-- 
1.7.10.4




[PATCH 3/7] drm/cirrus: phase 3: atomic updates of planes

2015-08-05 Thread John Hunter
From: Zhao Junwang 

Now that phase 1 and 2 are complete we can switch the
update/disable_plane callbacks to their atomic version

Cc: Daniel Vetter 
Cc: Gerd Hoffmann 
Cc: Matthew Garrett 
Cc: Dave Airlie 
Signed-off-by: Zhao Junwang 
---
 drivers/gpu/drm/cirrus/cirrus_main.c |3 +++
 drivers/gpu/drm/cirrus/cirrus_mode.c |4 ++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/cirrus/cirrus_main.c 
b/drivers/gpu/drm/cirrus/cirrus_main.c
index d95de34..cfa92bc 100644
--- a/drivers/gpu/drm/cirrus/cirrus_main.c
+++ b/drivers/gpu/drm/cirrus/cirrus_main.c
@@ -10,6 +10,7 @@
  */
 #include 
 #include 
+#include 

 #include "cirrus_drv.h"

@@ -82,6 +83,8 @@ cirrus_user_framebuffer_create(struct drm_device *dev,

 static const struct drm_mode_config_funcs cirrus_mode_funcs = {
.fb_create = cirrus_user_framebuffer_create,
+   .atomic_check = drm_atomic_helper_check,
+   .atomic_commit = drm_atomic_helper_commit,
 };

 /* Unmap the framebuffer from the core and release the memory */
diff --git a/drivers/gpu/drm/cirrus/cirrus_mode.c 
b/drivers/gpu/drm/cirrus/cirrus_mode.c
index 42a4d86..e8f038b 100644
--- a/drivers/gpu/drm/cirrus/cirrus_mode.c
+++ b/drivers/gpu/drm/cirrus/cirrus_mode.c
@@ -431,8 +431,8 @@ static void cirrus_plane_atomic_disable(struct drm_plane 
*plane,
 }

 static const struct drm_plane_funcs cirrus_plane_funcs = {
-   .update_plane = drm_plane_helper_update,
-   .disable_plane = drm_plane_helper_disable,
+   .update_plane = drm_atomic_helper_update_plane,
+   .disable_plane = drm_atomic_helper_disable_plane,
.reset = drm_atomic_helper_plane_reset,
.atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state,
.atomic_destroy_state = drm_atomic_helper_plane_destroy_state,
-- 
1.7.10.4




[PATCH 2/7] drm/cirrus: phase 2: wire up state reset, duplicate and destroy

2015-08-05 Thread John Hunter
From: Zhao Junwang 

Set CRTC, planes and connectors to use the default implementations
from the atomic helper library.

Cc: Daniel Vetter 
Cc: Gerd Hoffmann 
Cc: Matthew Garrett 
Cc: Dave Airlie 
Signed-off-by: Zhao Junwang 
---
 drivers/gpu/drm/cirrus/cirrus_mode.c |   12 
 1 file changed, 12 insertions(+)

diff --git a/drivers/gpu/drm/cirrus/cirrus_mode.c 
b/drivers/gpu/drm/cirrus/cirrus_mode.c
index 7a7c874..42a4d86 100644
--- a/drivers/gpu/drm/cirrus/cirrus_mode.c
+++ b/drivers/gpu/drm/cirrus/cirrus_mode.c
@@ -17,6 +17,7 @@
 #include 
 #include 
 #include 
+#include 

 #include 

@@ -304,6 +305,9 @@ static const struct drm_crtc_funcs cirrus_crtc_funcs = {
.gamma_set = cirrus_crtc_gamma_set,
.set_config = drm_crtc_helper_set_config,
.destroy = cirrus_crtc_destroy,
+   .reset = drm_atomic_helper_crtc_reset,
+   .atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state,
+   .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
 };

 static const struct drm_crtc_helper_funcs cirrus_helper_funcs = {
@@ -429,6 +433,9 @@ static void cirrus_plane_atomic_disable(struct drm_plane 
*plane,
 static const struct drm_plane_funcs cirrus_plane_funcs = {
.update_plane = drm_plane_helper_update,
.disable_plane = drm_plane_helper_disable,
+   .reset = drm_atomic_helper_plane_reset,
+   .atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state,
+   .atomic_destroy_state = drm_atomic_helper_plane_destroy_state,
 };

 static const struct drm_plane_helper_funcs cirrus_plane_helper_funcs = {
@@ -593,6 +600,9 @@ struct drm_connector_funcs cirrus_vga_connector_funcs = {
.detect = cirrus_vga_detect,
.fill_modes = drm_helper_probe_single_connector_modes,
.destroy = cirrus_connector_destroy,
+   .reset = drm_atomic_helper_connector_reset,
+   .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
+   .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
 };

 static struct drm_connector *cirrus_vga_init(struct drm_device *dev)
@@ -648,6 +658,8 @@ int cirrus_modeset_init(struct cirrus_device *cdev)
return -1;
}

+   drm_mode_config_reset(cdev->dev);
+
drm_mode_connector_attach_encoder(connector, encoder);

ret = cirrus_fbdev_init(cdev);
-- 
1.7.10.4




[PATCH 1/7] drm/cirrus: phase 1 - use the transitional helpers

2015-08-05 Thread John Hunter
From: Zhao Junwang 

-register driver's own primary plane
-use drm_crtc_init_with_planes instead drm_crtc_init

-the new atomic_infrastructure needs ->mode_set_nofb callback

Cc: Daniel Vetter 
Cc: Gerd Hoffmann 
Cc: Matthew Garrett 
Cc: Dave Airlie 
Signed-off-by: Zhao Junwang 
---
 drivers/gpu/drm/cirrus/cirrus_drv.c  |1 -
 drivers/gpu/drm/cirrus/cirrus_drv.h  |3 +-
 drivers/gpu/drm/cirrus/cirrus_main.c |2 +-
 drivers/gpu/drm/cirrus/cirrus_mode.c |  201 +-
 4 files changed, 129 insertions(+), 78 deletions(-)

diff --git a/drivers/gpu/drm/cirrus/cirrus_drv.c 
b/drivers/gpu/drm/cirrus/cirrus_drv.c
index 08bd176..80f1cd2 100644
--- a/drivers/gpu/drm/cirrus/cirrus_drv.c
+++ b/drivers/gpu/drm/cirrus/cirrus_drv.c
@@ -40,7 +40,6 @@ static const struct pci_device_id pciidlist[] = {
{0,}
 };

-
 static int cirrus_kick_out_firmware_fb(struct pci_dev *pdev)
 {
struct apertures_struct *ap;
diff --git a/drivers/gpu/drm/cirrus/cirrus_drv.h 
b/drivers/gpu/drm/cirrus/cirrus_drv.h
index 7050615..bd1ff51 100644
--- a/drivers/gpu/drm/cirrus/cirrus_drv.h
+++ b/drivers/gpu/drm/cirrus/cirrus_drv.h
@@ -135,8 +135,9 @@ struct cirrus_device {
resource_size_t rmmio_size;
void __iomem*rmmio;

-   struct cirrus_mcmc;
+   struct cirrus_mcmc;
struct cirrus_mode_info mode_info;
+   struct drm_planeprimary;

int num_crtc;
int fb_mtrr;
diff --git a/drivers/gpu/drm/cirrus/cirrus_main.c 
b/drivers/gpu/drm/cirrus/cirrus_main.c
index e4b9766..d95de34 100644
--- a/drivers/gpu/drm/cirrus/cirrus_main.c
+++ b/drivers/gpu/drm/cirrus/cirrus_main.c
@@ -308,10 +308,10 @@ cirrus_dumb_mmap_offset(struct drm_file *file,

drm_gem_object_unreference(obj);
ret = 0;
+
 out_unlock:
mutex_unlock(>struct_mutex);
return ret;
-
 }

 bool cirrus_check_framebuffer(struct cirrus_device *cdev, int width, int 
height,
diff --git a/drivers/gpu/drm/cirrus/cirrus_mode.c 
b/drivers/gpu/drm/cirrus/cirrus_mode.c
index 61385f2..7a7c874 100644
--- a/drivers/gpu/drm/cirrus/cirrus_mode.c
+++ b/drivers/gpu/drm/cirrus/cirrus_mode.c
@@ -27,6 +27,10 @@
 #define PALETTE_INDEX 0x8
 #define PALETTE_DATA 0x9

+static const uint32_t cirrus_primary_formats[] = {
+   DRM_FORMAT_RGB888,
+};
+
 /*
  * This file contains setup code for the CRTC.
  */
@@ -126,77 +130,11 @@ static void cirrus_set_start_address(struct drm_crtc 
*crtc, unsigned offset)
WREG_CRT(0x1d, tmp);
 }

-/* cirrus is different - we will force move buffers out of VRAM */
-static int cirrus_crtc_do_set_base(struct drm_crtc *crtc,
-   struct drm_framebuffer *fb,
-   int x, int y, int atomic)
-{
-   struct cirrus_device *cdev = crtc->dev->dev_private;
-   struct drm_gem_object *obj;
-   struct cirrus_framebuffer *cirrus_fb;
-   struct cirrus_bo *bo;
-   int ret;
-   u64 gpu_addr;
-
-   /* push the previous fb to system ram */
-   if (!atomic && fb) {
-   cirrus_fb = to_cirrus_framebuffer(fb);
-   obj = cirrus_fb->obj;
-   bo = gem_to_cirrus_bo(obj);
-   ret = cirrus_bo_reserve(bo, false);
-   if (ret)
-   return ret;
-   cirrus_bo_push_sysram(bo);
-   cirrus_bo_unreserve(bo);
-   }
-
-   cirrus_fb = to_cirrus_framebuffer(crtc->primary->fb);
-   obj = cirrus_fb->obj;
-   bo = gem_to_cirrus_bo(obj);
-
-   ret = cirrus_bo_reserve(bo, false);
-   if (ret)
-   return ret;
-
-   ret = cirrus_bo_pin(bo, TTM_PL_FLAG_VRAM, _addr);
-   if (ret) {
-   cirrus_bo_unreserve(bo);
-   return ret;
-   }
-
-   if (>mode_info.gfbdev->gfb == cirrus_fb) {
-   /* if pushing console in kmap it */
-   ret = ttm_bo_kmap(>bo, 0, bo->bo.num_pages, >kmap);
-   if (ret)
-   DRM_ERROR("failed to kmap fbcon\n");
-   }
-   cirrus_bo_unreserve(bo);
-
-   cirrus_set_start_address(crtc, (u32)gpu_addr);
-   return 0;
-}
-
-static int cirrus_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,
-struct drm_framebuffer *old_fb)
-{
-   return cirrus_crtc_do_set_base(crtc, old_fb, x, y, 0);
-}
-
-/*
- * The meat of this driver. The core passes us a mode and we have to program
- * it. The modesetting here is the bare minimum required to satisfy the qemu
- * emulation of this hardware, and running this against a real device is
- * likely to result in an inadequately programmed mode. We've already had
- * the opportunity to modify the mode, so whatever we receive here should
- * be something that can be correctly programmed and displayed
- */
-static int cirrus_crtc_mode_set(struct drm_crtc *crtc,
-  

[PATCH 0/7] drm/cirrus: convert cirrus to atomic mode-setting

2015-08-05 Thread John Hunter
From: Zhao Junwang 

This patch series aim to convert DRM_CIRRUS to atomic mode-setting.
This mostly reference my previous patch series on DRM_BOCHS and
Gustavo Padovan;s patch series on drm/exynos.

Zhao Junwang (7):
  drm/cirrus: phase 1 - use the transitional helpers
  drm/cirrus: phase 2: wire up state reset, duplicate and destroy
  drm/cirrus: phase 3: atomic updates of planes
  drm/cirrus: add return 0 to make sure if (bo->pin_count) early_exit
  drm/cirrus: phase 3: use atomic .set_config helper
  drm/cirrus: atomic dpms support
  drm/cirrus: add DRIVER_ATOMIC to .driver_features

 drivers/gpu/drm/cirrus/cirrus_drv.c  |3 +-
 drivers/gpu/drm/cirrus/cirrus_drv.h  |3 +-
 drivers/gpu/drm/cirrus/cirrus_main.c |5 +-
 drivers/gpu/drm/cirrus/cirrus_mode.c |  299 --
 drivers/gpu/drm/cirrus/cirrus_ttm.c  |2 +
 5 files changed, 187 insertions(+), 125 deletions(-)

-- 
1.7.10.4




[PATCH 7/7] drm/cirrus: add DRIVER_ATOMIC to .driver_features

2015-08-05 Thread John Hunter
From: Zhao Junwang 

Since  driver is now fully atomic, we should add DRIVER_ATOMIC to
.driver_features

Cc: Daniel Vetter 
Cc: Gerd Hoffmann 
Cc: Matthew Garrett 
Cc: Dave Airlie 
Cc: Zhao Junwang 
Signed-off-by: Zhao Junwang 
---
 drivers/gpu/drm/cirrus/cirrus_drv.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/cirrus/cirrus_drv.c 
b/drivers/gpu/drm/cirrus/cirrus_drv.c
index 80f1cd2..742647b 100644
--- a/drivers/gpu/drm/cirrus/cirrus_drv.c
+++ b/drivers/gpu/drm/cirrus/cirrus_drv.c
@@ -130,7 +130,7 @@ static const struct file_operations cirrus_driver_fops = {
 #endif
 };
 static struct drm_driver driver = {
-   .driver_features = DRIVER_MODESET | DRIVER_GEM,
+   .driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_ATOMIC,
.load = cirrus_driver_load,
.unload = cirrus_driver_unload,
.set_busid = drm_pci_set_busid,
-- 
1.7.10.4




[PATCH 7/7] drm/cirrus: add DRIVER_ATOMIC to .driver_features

2015-07-30 Thread John Hunter
From: Zhao Junwang 

Since  driver is now fully atomic, we should add DRIVER_ATOMIC to
.driver_features

Signed-off-by: Zhao Junwang 
---
 drivers/gpu/drm/cirrus/cirrus_drv.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/cirrus/cirrus_drv.c 
b/drivers/gpu/drm/cirrus/cirrus_drv.c
index 80f1cd2..742647b 100644
--- a/drivers/gpu/drm/cirrus/cirrus_drv.c
+++ b/drivers/gpu/drm/cirrus/cirrus_drv.c
@@ -130,7 +130,7 @@ static const struct file_operations cirrus_driver_fops = {
 #endif
 };
 static struct drm_driver driver = {
-   .driver_features = DRIVER_MODESET | DRIVER_GEM,
+   .driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_ATOMIC,
.load = cirrus_driver_load,
.unload = cirrus_driver_unload,
.set_busid = drm_pci_set_busid,
-- 
1.7.10.4




[PATCH 6/7] drm/cirrus: atomic dpms support

2015-07-30 Thread John Hunter
From: Zhao Junwang 

Run dpms operations through the atomic interfaces. This basically
removes the .dpms() callback from encoders and crtcs and use .disable
and .enable to turn the crtc on and off.

use drm_atomic_helper_connector_dpms for connector

Signed-off-by: Zhao Junwang 
---
 drivers/gpu/drm/cirrus/cirrus_mode.c |   68 +++---
 1 file changed, 39 insertions(+), 29 deletions(-)

diff --git a/drivers/gpu/drm/cirrus/cirrus_mode.c 
b/drivers/gpu/drm/cirrus/cirrus_mode.c
index 1775864..e807cf0 100644
--- a/drivers/gpu/drm/cirrus/cirrus_mode.c
+++ b/drivers/gpu/drm/cirrus/cirrus_mode.c
@@ -55,37 +55,40 @@ static void cirrus_crtc_load_lut(struct drm_crtc *crtc)
}
 }

-/*
- * The DRM core requires DPMS functions, but they make little sense in our
- * case and so are just stubs
- */
+static void cirrus_crtc_enable(struct drm_crtc *crtc)
+{
+   struct drm_device *dev = crtc->dev;
+   struct cirrus_device *cdev = dev->dev_private;
+   u8 sr01, gr0e;
+
+   if (crtc->enabled)
+   return;

-static void cirrus_crtc_dpms(struct drm_crtc *crtc, int mode)
+   sr01 = 0x00;
+   gr0e = 0x00;
+
+   WREG8(SEQ_INDEX, 0x1);
+   sr01 |= RREG8(SEQ_DATA) & ~0x20;
+   WREG_SEQ(0x1, sr01);
+
+   WREG8(GFX_INDEX, 0xe);
+   gr0e |= RREG8(GFX_DATA) & ~0x06;
+   WREG_GFX(0xe, gr0e);
+
+   crtc->enabled = true;
+}
+
+static void cirrus_crtc_disable(struct drm_crtc *crtc)
 {
struct drm_device *dev = crtc->dev;
struct cirrus_device *cdev = dev->dev_private;
u8 sr01, gr0e;

-   switch (mode) {
-   case DRM_MODE_DPMS_ON:
-   sr01 = 0x00;
-   gr0e = 0x00;
-   break;
-   case DRM_MODE_DPMS_STANDBY:
-   sr01 = 0x20;
-   gr0e = 0x02;
-   break;
-   case DRM_MODE_DPMS_SUSPEND:
-   sr01 = 0x20;
-   gr0e = 0x04;
-   break;
-   case DRM_MODE_DPMS_OFF:
-   sr01 = 0x20;
-   gr0e = 0x06;
-   break;
-   default:
+   if (!crtc->enabled)
return;
-   }
+
+   sr01 = 0x20;
+   gr0e = 0x06;

WREG8(SEQ_INDEX, 0x1);
sr01 |= RREG8(SEQ_DATA) & ~0x20;
@@ -94,6 +97,8 @@ static void cirrus_crtc_dpms(struct drm_crtc *crtc, int mode)
WREG8(GFX_INDEX, 0xe);
gr0e |= RREG8(GFX_DATA) & ~0x06;
WREG_GFX(0xe, gr0e);
+
+   crtc->enabled = false;
 }

 /*
@@ -303,7 +308,8 @@ static const struct drm_crtc_funcs cirrus_crtc_funcs = {
 };

 static const struct drm_crtc_helper_funcs cirrus_helper_funcs = {
-   .dpms = cirrus_crtc_dpms,
+   .disable = cirrus_crtc_disable,
+   .enable = cirrus_crtc_enable,
.mode_fixup = cirrus_crtc_mode_fixup,
.mode_set_nofb = cirrus_crtc_mode_set_nofb,
.commit = cirrus_crtc_commit,
@@ -490,9 +496,12 @@ static void cirrus_encoder_mode_set(struct drm_encoder 
*encoder,
 {
 }

-static void cirrus_encoder_dpms(struct drm_encoder *encoder, int state)
+static void cirrus_encoder_enable(struct drm_encoder *encoder)
+{
+}
+
+static void cirrus_encoder_disable(struct drm_encoder *encoder)
 {
-   return;
 }

 static void cirrus_encoder_commit(struct drm_encoder *encoder)
@@ -507,7 +516,8 @@ static void cirrus_encoder_destroy(struct drm_encoder 
*encoder)
 }

 static const struct drm_encoder_helper_funcs cirrus_encoder_helper_funcs = {
-   .dpms = cirrus_encoder_dpms,
+   .enable = cirrus_encoder_enable,
+   .disable = cirrus_encoder_disable,
.mode_fixup = cirrus_encoder_mode_fixup,
.mode_set = cirrus_encoder_mode_set,
.commit = cirrus_encoder_commit,
@@ -580,7 +590,7 @@ struct drm_connector_helper_funcs 
cirrus_vga_connector_helper_funcs = {
 };

 struct drm_connector_funcs cirrus_vga_connector_funcs = {
-   .dpms = drm_helper_connector_dpms,
+   .dpms = drm_atomic_helper_connector_dpms,
.detect = cirrus_vga_detect,
.fill_modes = drm_helper_probe_single_connector_modes,
.destroy = cirrus_connector_destroy,
-- 
1.7.10.4




[PATCH 5/7] drm/cirrus: phase 3: use atomic .set_config helper

2015-07-30 Thread John Hunter
From: Zhao Junwang 

Now that phase 1 and phase 2 are completed, switch .set_config
helper to use the atomic one.

-stop looking legacy crtc->primary->fb, instead we should use
crtc->primary->state->fb

.prepare() calls are no more needed, remove them
.mode_set() and .mode_set_base are no longer needed, remove

Signed-off-by: Zhao Junwang 
---
 drivers/gpu/drm/cirrus/cirrus_mode.c |   28 ++--
 1 file changed, 6 insertions(+), 22 deletions(-)

diff --git a/drivers/gpu/drm/cirrus/cirrus_mode.c 
b/drivers/gpu/drm/cirrus/cirrus_mode.c
index e8f038b..1775864 100644
--- a/drivers/gpu/drm/cirrus/cirrus_mode.c
+++ b/drivers/gpu/drm/cirrus/cirrus_mode.c
@@ -208,7 +208,8 @@ static void cirrus_crtc_mode_set_nofb(struct drm_crtc *crtc)
sr07 = RREG8(SEQ_DATA);
sr07 &= 0xe0;
hdr = 0;
-   switch (crtc->primary->fb->bits_per_pixel) {
+
+   switch (crtc->primary->state->fb->bits_per_pixel) {
case 8:
sr07 |= 0x11;
break;
@@ -231,13 +232,13 @@ static void cirrus_crtc_mode_set_nofb(struct drm_crtc 
*crtc)
WREG_SEQ(0x7, sr07);

/* Program the pitch */
-   tmp = crtc->primary->fb->pitches[0] / 8;
+   tmp = crtc->primary->state->fb->pitches[0] / 8;
WREG_CRT(VGA_CRTC_OFFSET, tmp);

/* Enable extended blanking and pitch bits, and enable full memory */
tmp = 0x22;
-   tmp |= (crtc->primary->fb->pitches[0] >> 7) & 0x10;
-   tmp |= (crtc->primary->fb->pitches[0] >> 6) & 0x40;
+   tmp |= (crtc->primary->state->fb->pitches[0] >> 7) & 0x10;
+   tmp |= (crtc->primary->state->fb->pitches[0] >> 6) & 0x40;
WREG_CRT(0x1b, tmp);

/* Enable high-colour modes */
@@ -253,15 +254,6 @@ static void cirrus_crtc_mode_set_nofb(struct drm_crtc 
*crtc)
 }

 /*
- * This is called before a mode is programmed. A typical use might be to
- * enable DPMS during the programming to avoid seeing intermediate stages,
- * but that's not relevant to us
- */
-static void cirrus_crtc_prepare(struct drm_crtc *crtc)
-{
-}
-
-/*
  * This is called after a mode is programmed. It should reverse anything done
  * by the prepare function
  */
@@ -303,7 +295,7 @@ static void cirrus_crtc_destroy(struct drm_crtc *crtc)
 /* These provide the minimum set of functions required to handle a CRTC */
 static const struct drm_crtc_funcs cirrus_crtc_funcs = {
.gamma_set = cirrus_crtc_gamma_set,
-   .set_config = drm_crtc_helper_set_config,
+   .set_config = drm_atomic_helper_set_config,
.destroy = cirrus_crtc_destroy,
.reset = drm_atomic_helper_crtc_reset,
.atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state,
@@ -313,10 +305,7 @@ static const struct drm_crtc_funcs cirrus_crtc_funcs = {
 static const struct drm_crtc_helper_funcs cirrus_helper_funcs = {
.dpms = cirrus_crtc_dpms,
.mode_fixup = cirrus_crtc_mode_fixup,
-   .mode_set = drm_helper_crtc_mode_set,
-   .mode_set_base = drm_helper_crtc_mode_set_base,
.mode_set_nofb = cirrus_crtc_mode_set_nofb,
-   .prepare = cirrus_crtc_prepare,
.commit = cirrus_crtc_commit,
.load_lut = cirrus_crtc_load_lut,
 };
@@ -506,10 +495,6 @@ static void cirrus_encoder_dpms(struct drm_encoder 
*encoder, int state)
return;
 }

-static void cirrus_encoder_prepare(struct drm_encoder *encoder)
-{
-}
-
 static void cirrus_encoder_commit(struct drm_encoder *encoder)
 {
 }
@@ -525,7 +510,6 @@ static const struct drm_encoder_helper_funcs 
cirrus_encoder_helper_funcs = {
.dpms = cirrus_encoder_dpms,
.mode_fixup = cirrus_encoder_mode_fixup,
.mode_set = cirrus_encoder_mode_set,
-   .prepare = cirrus_encoder_prepare,
.commit = cirrus_encoder_commit,
 };

-- 
1.7.10.4




[PATCH 4/7] drm/cirrus: add return 0 to make sure if (bo->pin_count) early_exit

2015-07-30 Thread John Hunter
From: Zhao Junwang 

when the first modeset calls prepare_fb, bo->pin_count change from
0 to 1, then the second modeset with the same fb, that should set
bo->pin_count to 2, and then when cleanup_fb was called, bo->pin_count
should be 2 to 1.

But in the cirrus_bo_pin, it will set bo->pin_count = 1 at the end
of the function, this results that bo->bin_count will never be larger
than 1 no matter how many times cirrus_bo_pin was called.

So we need to add a condition before bo->pin_count = 1

V2: if (bo->pin_count) early_exit; do_the_real_pinning work

Signed-off-by: Zhao Junwang 
---
 drivers/gpu/drm/cirrus/cirrus_ttm.c |2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/cirrus/cirrus_ttm.c 
b/drivers/gpu/drm/cirrus/cirrus_ttm.c
index dfffd52..756b6d0 100644
--- a/drivers/gpu/drm/cirrus/cirrus_ttm.c
+++ b/drivers/gpu/drm/cirrus/cirrus_ttm.c
@@ -364,6 +364,8 @@ int cirrus_bo_pin(struct cirrus_bo *bo, u32 pl_flag, u64 
*gpu_addr)
bo->pin_count++;
if (gpu_addr)
*gpu_addr = cirrus_bo_gpu_offset(bo);
+
+   return 0;
}

cirrus_ttm_placement(bo, pl_flag);
-- 
1.7.10.4




[PATCH 3/7] drm/cirrus: phase 3: atomic updates of planes

2015-07-30 Thread John Hunter
From: Zhao Junwang 

Now that phase 1 and 2 are complete we can switch the
update/disable_plane callbacks to their atomic version

Signed-off-by: Zhao Junwang 
---
 drivers/gpu/drm/cirrus/cirrus_main.c |3 +++
 drivers/gpu/drm/cirrus/cirrus_mode.c |4 ++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/cirrus/cirrus_main.c 
b/drivers/gpu/drm/cirrus/cirrus_main.c
index d95de34..cfa92bc 100644
--- a/drivers/gpu/drm/cirrus/cirrus_main.c
+++ b/drivers/gpu/drm/cirrus/cirrus_main.c
@@ -10,6 +10,7 @@
  */
 #include 
 #include 
+#include 

 #include "cirrus_drv.h"

@@ -82,6 +83,8 @@ cirrus_user_framebuffer_create(struct drm_device *dev,

 static const struct drm_mode_config_funcs cirrus_mode_funcs = {
.fb_create = cirrus_user_framebuffer_create,
+   .atomic_check = drm_atomic_helper_check,
+   .atomic_commit = drm_atomic_helper_commit,
 };

 /* Unmap the framebuffer from the core and release the memory */
diff --git a/drivers/gpu/drm/cirrus/cirrus_mode.c 
b/drivers/gpu/drm/cirrus/cirrus_mode.c
index 42a4d86..e8f038b 100644
--- a/drivers/gpu/drm/cirrus/cirrus_mode.c
+++ b/drivers/gpu/drm/cirrus/cirrus_mode.c
@@ -431,8 +431,8 @@ static void cirrus_plane_atomic_disable(struct drm_plane 
*plane,
 }

 static const struct drm_plane_funcs cirrus_plane_funcs = {
-   .update_plane = drm_plane_helper_update,
-   .disable_plane = drm_plane_helper_disable,
+   .update_plane = drm_atomic_helper_update_plane,
+   .disable_plane = drm_atomic_helper_disable_plane,
.reset = drm_atomic_helper_plane_reset,
.atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state,
.atomic_destroy_state = drm_atomic_helper_plane_destroy_state,
-- 
1.7.10.4




[PATCH 2/7] drm/cirrus: phase 2: wire up state reset, duplicate and destroy

2015-07-30 Thread John Hunter
From: Zhao Junwang 

Set CRTC, planes and connectors to use the default implementations
from the atomic helper library.

Signed-off-by: Zhao Junwang 
---
 drivers/gpu/drm/cirrus/cirrus_mode.c |   12 
 1 file changed, 12 insertions(+)

diff --git a/drivers/gpu/drm/cirrus/cirrus_mode.c 
b/drivers/gpu/drm/cirrus/cirrus_mode.c
index 7a7c874..42a4d86 100644
--- a/drivers/gpu/drm/cirrus/cirrus_mode.c
+++ b/drivers/gpu/drm/cirrus/cirrus_mode.c
@@ -17,6 +17,7 @@
 #include 
 #include 
 #include 
+#include 

 #include 

@@ -304,6 +305,9 @@ static const struct drm_crtc_funcs cirrus_crtc_funcs = {
.gamma_set = cirrus_crtc_gamma_set,
.set_config = drm_crtc_helper_set_config,
.destroy = cirrus_crtc_destroy,
+   .reset = drm_atomic_helper_crtc_reset,
+   .atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state,
+   .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
 };

 static const struct drm_crtc_helper_funcs cirrus_helper_funcs = {
@@ -429,6 +433,9 @@ static void cirrus_plane_atomic_disable(struct drm_plane 
*plane,
 static const struct drm_plane_funcs cirrus_plane_funcs = {
.update_plane = drm_plane_helper_update,
.disable_plane = drm_plane_helper_disable,
+   .reset = drm_atomic_helper_plane_reset,
+   .atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state,
+   .atomic_destroy_state = drm_atomic_helper_plane_destroy_state,
 };

 static const struct drm_plane_helper_funcs cirrus_plane_helper_funcs = {
@@ -593,6 +600,9 @@ struct drm_connector_funcs cirrus_vga_connector_funcs = {
.detect = cirrus_vga_detect,
.fill_modes = drm_helper_probe_single_connector_modes,
.destroy = cirrus_connector_destroy,
+   .reset = drm_atomic_helper_connector_reset,
+   .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
+   .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
 };

 static struct drm_connector *cirrus_vga_init(struct drm_device *dev)
@@ -648,6 +658,8 @@ int cirrus_modeset_init(struct cirrus_device *cdev)
return -1;
}

+   drm_mode_config_reset(cdev->dev);
+
drm_mode_connector_attach_encoder(connector, encoder);

ret = cirrus_fbdev_init(cdev);
-- 
1.7.10.4




[PATCH 1/7] drm/cirrus: phase 1 - use the transitional helpers

2015-07-30 Thread John Hunter
From: Zhao Junwang 

-register driver's own primary plane
-use drm_crtc_init_with_planes instead drm_crtc_init

-the new atomic_infrastructure needs ->mode_set_nofb callback

Signed-off-by: Zhao Junwang 
---
 drivers/gpu/drm/cirrus/cirrus_drv.c  |1 -
 drivers/gpu/drm/cirrus/cirrus_drv.h  |3 +-
 drivers/gpu/drm/cirrus/cirrus_main.c |2 +-
 drivers/gpu/drm/cirrus/cirrus_mode.c |  201 +-
 4 files changed, 129 insertions(+), 78 deletions(-)

diff --git a/drivers/gpu/drm/cirrus/cirrus_drv.c 
b/drivers/gpu/drm/cirrus/cirrus_drv.c
index 08bd176..80f1cd2 100644
--- a/drivers/gpu/drm/cirrus/cirrus_drv.c
+++ b/drivers/gpu/drm/cirrus/cirrus_drv.c
@@ -40,7 +40,6 @@ static const struct pci_device_id pciidlist[] = {
{0,}
 };

-
 static int cirrus_kick_out_firmware_fb(struct pci_dev *pdev)
 {
struct apertures_struct *ap;
diff --git a/drivers/gpu/drm/cirrus/cirrus_drv.h 
b/drivers/gpu/drm/cirrus/cirrus_drv.h
index 7050615..bd1ff51 100644
--- a/drivers/gpu/drm/cirrus/cirrus_drv.h
+++ b/drivers/gpu/drm/cirrus/cirrus_drv.h
@@ -135,8 +135,9 @@ struct cirrus_device {
resource_size_t rmmio_size;
void __iomem*rmmio;

-   struct cirrus_mcmc;
+   struct cirrus_mcmc;
struct cirrus_mode_info mode_info;
+   struct drm_planeprimary;

int num_crtc;
int fb_mtrr;
diff --git a/drivers/gpu/drm/cirrus/cirrus_main.c 
b/drivers/gpu/drm/cirrus/cirrus_main.c
index e4b9766..d95de34 100644
--- a/drivers/gpu/drm/cirrus/cirrus_main.c
+++ b/drivers/gpu/drm/cirrus/cirrus_main.c
@@ -308,10 +308,10 @@ cirrus_dumb_mmap_offset(struct drm_file *file,

drm_gem_object_unreference(obj);
ret = 0;
+
 out_unlock:
mutex_unlock(>struct_mutex);
return ret;
-
 }

 bool cirrus_check_framebuffer(struct cirrus_device *cdev, int width, int 
height,
diff --git a/drivers/gpu/drm/cirrus/cirrus_mode.c 
b/drivers/gpu/drm/cirrus/cirrus_mode.c
index 61385f2..7a7c874 100644
--- a/drivers/gpu/drm/cirrus/cirrus_mode.c
+++ b/drivers/gpu/drm/cirrus/cirrus_mode.c
@@ -27,6 +27,10 @@
 #define PALETTE_INDEX 0x8
 #define PALETTE_DATA 0x9

+static const uint32_t cirrus_primary_formats[] = {
+   DRM_FORMAT_RGB888,
+};
+
 /*
  * This file contains setup code for the CRTC.
  */
@@ -126,77 +130,11 @@ static void cirrus_set_start_address(struct drm_crtc 
*crtc, unsigned offset)
WREG_CRT(0x1d, tmp);
 }

-/* cirrus is different - we will force move buffers out of VRAM */
-static int cirrus_crtc_do_set_base(struct drm_crtc *crtc,
-   struct drm_framebuffer *fb,
-   int x, int y, int atomic)
-{
-   struct cirrus_device *cdev = crtc->dev->dev_private;
-   struct drm_gem_object *obj;
-   struct cirrus_framebuffer *cirrus_fb;
-   struct cirrus_bo *bo;
-   int ret;
-   u64 gpu_addr;
-
-   /* push the previous fb to system ram */
-   if (!atomic && fb) {
-   cirrus_fb = to_cirrus_framebuffer(fb);
-   obj = cirrus_fb->obj;
-   bo = gem_to_cirrus_bo(obj);
-   ret = cirrus_bo_reserve(bo, false);
-   if (ret)
-   return ret;
-   cirrus_bo_push_sysram(bo);
-   cirrus_bo_unreserve(bo);
-   }
-
-   cirrus_fb = to_cirrus_framebuffer(crtc->primary->fb);
-   obj = cirrus_fb->obj;
-   bo = gem_to_cirrus_bo(obj);
-
-   ret = cirrus_bo_reserve(bo, false);
-   if (ret)
-   return ret;
-
-   ret = cirrus_bo_pin(bo, TTM_PL_FLAG_VRAM, _addr);
-   if (ret) {
-   cirrus_bo_unreserve(bo);
-   return ret;
-   }
-
-   if (>mode_info.gfbdev->gfb == cirrus_fb) {
-   /* if pushing console in kmap it */
-   ret = ttm_bo_kmap(>bo, 0, bo->bo.num_pages, >kmap);
-   if (ret)
-   DRM_ERROR("failed to kmap fbcon\n");
-   }
-   cirrus_bo_unreserve(bo);
-
-   cirrus_set_start_address(crtc, (u32)gpu_addr);
-   return 0;
-}
-
-static int cirrus_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,
-struct drm_framebuffer *old_fb)
-{
-   return cirrus_crtc_do_set_base(crtc, old_fb, x, y, 0);
-}
-
-/*
- * The meat of this driver. The core passes us a mode and we have to program
- * it. The modesetting here is the bare minimum required to satisfy the qemu
- * emulation of this hardware, and running this against a real device is
- * likely to result in an inadequately programmed mode. We've already had
- * the opportunity to modify the mode, so whatever we receive here should
- * be something that can be correctly programmed and displayed
- */
-static int cirrus_crtc_mode_set(struct drm_crtc *crtc,
-   struct drm_display_mode *mode,
-   

[PATCH 0/7] drm/cirrus: convert cirrus to atomic mode-setting

2015-07-30 Thread John Hunter
From: Zhao Junwang 

This patch series aim to convert DRM_CIRRUS to atomic mode-setting.
This mostly reference my previous patch series on DRM_BOCHS and
Gustavo Padovan;s patch series on drm/exynos.

Zhao Junwang (7):
  drm/cirrus: phase 1 - use the transitional helpers
  drm/cirrus: phase 2: wire up state reset, duplicate and destroy
  drm/cirrus: phase 3: atomic updates of planes
  drm/cirrus: add return 0 to make sure if (bo->pin_count) early_exit
  drm/cirrus: phase 3: use atomic .set_config helper
  drm/cirrus: atomic dpms support
  drm/cirrus: add DRIVER_ATOMIC to .driver_features

 drivers/gpu/drm/cirrus/cirrus_drv.c  |3 +-
 drivers/gpu/drm/cirrus/cirrus_drv.h  |3 +-
 drivers/gpu/drm/cirrus/cirrus_main.c |5 +-
 drivers/gpu/drm/cirrus/cirrus_mode.c |  299 --
 drivers/gpu/drm/cirrus/cirrus_ttm.c  |2 +
 5 files changed, 187 insertions(+), 125 deletions(-)

-- 
1.7.10.4




[PATCH v2 1/8] drm/bochs: phase 1 - use the transitional helpers

2015-07-20 Thread John Hunter
From: Zhao Junwang 

-register driver's own primary plane
-use drm_crtc_init_with_planes instead of drm_crtc_init

-split ->mode_set into:
1. set the new hw mode
2. update the primary plane (This is done by ->set_base)
-move what ->set_base do into ->atomic_update

-the new atomic infrastructure needs the ->mode_set_nofb callback
 to update CRTC timings before setting any plane

-since the ->cleanup_fb can't fail, set the interruptible argument
 of the ttm_bo_reserve to false, this make sure the ttm_bo_reserve
 can't fail

v2: -add a few checks to plane's ->atomic_check, using
 drm_plane_helper_check_update

v3: -polish the atomic_check, it does too much in v2, remove the
 ->disable_plane and ->set_config

v4: -use plane->state instead of old_state in
 bochs_plane_atomic_update

v5: -just return 0 in plane ->atomic_check, i.e. remove what we
 do in v2-v4

v6: -remove gpu_addr and look up the bo offset same as
 bochs_bo_gpu_offset
-add atomic_plane_disable hook, this will guarantee when it
 calls atomic_plane_update state->fb and state->crtc are both
 non-NULL

Cc: Gerd Hoffmann 
Cc: Maarten Lankhorst 
Cc: Daniel Vetter 
Signed-off-by: Zhao Junwang 
---
 drivers/gpu/drm/bochs/bochs.h |2 +
 drivers/gpu/drm/bochs/bochs_kms.c |  169 +
 2 files changed, 118 insertions(+), 53 deletions(-)

diff --git a/drivers/gpu/drm/bochs/bochs.h b/drivers/gpu/drm/bochs/bochs.h
index 71f2687..2f10480 100644
--- a/drivers/gpu/drm/bochs/bochs.h
+++ b/drivers/gpu/drm/bochs/bochs.h
@@ -5,6 +5,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 

 #include 
@@ -72,6 +73,7 @@ struct bochs_device {

/* drm */
struct drm_device  *dev;
+   struct drm_plane primary;
struct drm_crtc crtc;
struct drm_encoder encoder;
struct drm_connector connector;
diff --git a/drivers/gpu/drm/bochs/bochs_kms.c 
b/drivers/gpu/drm/bochs/bochs_kms.c
index 26bcd03..0eda7fe 100644
--- a/drivers/gpu/drm/bochs/bochs_kms.c
+++ b/drivers/gpu/drm/bochs/bochs_kms.c
@@ -11,6 +11,10 @@
 static int defx = 1024;
 static int defy = 768;

+static const uint32_t bochs_primary_formats[] = {
+   DRM_FORMAT_XRGB,
+};
+
 module_param(defx, int, 0444);
 module_param(defy, int, 0444);
 MODULE_PARM_DESC(defx, "default x resolution");
@@ -37,59 +41,12 @@ static bool bochs_crtc_mode_fixup(struct drm_crtc *crtc,
return true;
 }

-static int bochs_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,
-   struct drm_framebuffer *old_fb)
-{
-   struct bochs_device *bochs =
-   container_of(crtc, struct bochs_device, crtc);
-   struct bochs_framebuffer *bochs_fb;
-   struct bochs_bo *bo;
-   u64 gpu_addr = 0;
-   int ret;
-
-   if (old_fb) {
-   bochs_fb = to_bochs_framebuffer(old_fb);
-   bo = gem_to_bochs_bo(bochs_fb->obj);
-   ret = ttm_bo_reserve(>bo, true, false, false, NULL);
-   if (ret) {
-   DRM_ERROR("failed to reserve old_fb bo\n");
-   } else {
-   bochs_bo_unpin(bo);
-   ttm_bo_unreserve(>bo);
-   }
-   }
-
-   if (WARN_ON(crtc->primary->fb == NULL))
-   return -EINVAL;
-
-   bochs_fb = to_bochs_framebuffer(crtc->primary->fb);
-   bo = gem_to_bochs_bo(bochs_fb->obj);
-   ret = ttm_bo_reserve(>bo, true, false, false, NULL);
-   if (ret)
-   return ret;
-
-   ret = bochs_bo_pin(bo, TTM_PL_FLAG_VRAM, _addr);
-   if (ret) {
-   ttm_bo_unreserve(>bo);
-   return ret;
-   }
-
-   ttm_bo_unreserve(>bo);
-   bochs_hw_setbase(bochs, x, y, gpu_addr);
-   return 0;
-}
-
-static int bochs_crtc_mode_set(struct drm_crtc *crtc,
-  struct drm_display_mode *mode,
-  struct drm_display_mode *adjusted_mode,
-  int x, int y, struct drm_framebuffer *old_fb)
+static void bochs_crtc_mode_set_nofb(struct drm_crtc *crtc)
 {
struct bochs_device *bochs =
container_of(crtc, struct bochs_device, crtc);

-   bochs_hw_setmode(bochs, mode);
-   bochs_crtc_mode_set_base(crtc, x, y, old_fb);
-   return 0;
+   bochs_hw_setmode(bochs, >mode);
 }

 static void bochs_crtc_prepare(struct drm_crtc *crtc)
@@ -116,7 +73,7 @@ static int bochs_crtc_page_flip(struct drm_crtc *crtc,
unsigned long irqflags;

crtc->primary->fb = fb;
-   bochs_crtc_mode_set_base(crtc, 0, 0, old_fb);
+   drm_helper_crtc_mode_set_base(crtc, 0, 0, old_fb);
if (event) {
spin_lock_irqsave(>dev->event_lock, irqflags);
drm_send_vblank_event(bochs->dev, -1, event);
@@ -136,8 +93,9 @@ static const struct drm_crtc_funcs bochs_crtc_funcs = {
 static const struct drm_crtc_helper_funcs 

[PATCH 6/8] drm/bochs: phase 3: provide a custom ->atomic_commit implementation

2015-07-20 Thread John Hunter
Hi Pekka,

Thanks for the information, I will talk to my mentor Daniel and try to find
out
what I can do about this.

Cheers,
Zhao Junwang

On Fri, Jul 17, 2015 at 2:08 PM, Pekka Paalanen  wrote:

> On Thu, 16 Jul 2015 20:20:39 +0800
> John Hunter  wrote:
>
> > From: Zhao Junwang 
> >
> > This supports the asynchronous commits, required for page-flipping
> > Since it's virtual hw it's ok to commit async stuff right away, we
> > never have to wait for vblank.
>
> Hi,
>
> in theory, yes. This is what a patch to bochs implemented not too long
> ago, so AFAIK you are only replicating the existing behaviour.
>
> However, if userspace doing an async commit (or sync, I suppose) does
> not incur any waits in the kernel in e.g. sending the page flip event,
> then flip driven programs (e.g. a Wayland compositor, say, Weston)
> will be running its rendering loop as a busy-loop, because the kernel
> does not throttle it to the (virtual) display refresh rate.
>
> This will cause maximal CPU usage and poor user experience as
> everything else needs to fight for CPU time and event dispatch to get
> through, like input.
>
> I would hope someone could do a follow-up to implement a refresh cycle
> emulation based on a clock. Userspace expects page flips to happen at
> most at refresh rate when asking for vblank-synced flips. It's only
> natural for userspace to drive its rendering loop based on the vblank
> cycle.
>
>
> Thanks,
> pq
>
> > Cc: Maarten Lankhorst 
> > Cc: Daniel Vetter 
> > Signed-off-by: Zhao Junwang 
> > ---
> >  drivers/gpu/drm/bochs/bochs_mm.c |9 -
> >  1 file changed, 8 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/bochs/bochs_mm.c
> b/drivers/gpu/drm/bochs/bochs_mm.c
> > index c1d819c..37ac2ca 100644
> > --- a/drivers/gpu/drm/bochs/bochs_mm.c
> > +++ b/drivers/gpu/drm/bochs/bochs_mm.c
> > @@ -545,8 +545,15 @@ bochs_user_framebuffer_create(struct drm_device
> *dev,
> >   return _fb->base;
> >  }
> >
> > +static int bochs_atomic_commit(struct drm_device *dev,
> > +  struct drm_atomic_state *a,
> > +  bool async)
> > +{
> > + return drm_atomic_helper_commit(dev, a, false);
> > +}
> > +
> >  const struct drm_mode_config_funcs bochs_mode_funcs = {
> >   .fb_create = bochs_user_framebuffer_create,
> >   .atomic_check = drm_atomic_helper_check,
> > - .atomic_commit = drm_atomic_helper_commit,
> > + .atomic_commit = bochs_atomic_commit,
> >  };
>
>


-- 
Best regards
Junwang Zhao
Microprocessor Research and Develop Center
Department of Computer Science 
Peking University
Beijing, 100871, PRC
-- next part --
An HTML attachment was scrubbed...
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20150720/214528ef/attachment.html>


[PATCH 8/8] drm/bochs: atomic dpms support

2015-07-16 Thread John Hunter
From: Zhao Junwang 

- use ->disable() and ->enable() for crct and plane
- use drm_atomic_helper_connector_dpms for connector

Cc: Maarten Lankhorst 
Cc: Daniel Vetter 
Signed-off-by: Zhao Junwang 
---
 drivers/gpu/drm/bochs/bochs_kms.c |   34 ++
 1 file changed, 22 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/bochs/bochs_kms.c 
b/drivers/gpu/drm/bochs/bochs_kms.c
index 599f367..eccd0a7 100644
--- a/drivers/gpu/drm/bochs/bochs_kms.c
+++ b/drivers/gpu/drm/bochs/bochs_kms.c
@@ -23,16 +23,20 @@ MODULE_PARM_DESC(defy, "default y resolution");

 /* -- */

-static void bochs_crtc_dpms(struct drm_crtc *crtc, int mode)
+static void bochs_crtc_enable(struct drm_crtc *crtc)
 {
-   switch (mode) {
-   case DRM_MODE_DPMS_ON:
-   case DRM_MODE_DPMS_STANDBY:
-   case DRM_MODE_DPMS_SUSPEND:
-   case DRM_MODE_DPMS_OFF:
-   default:
+   if (crtc->enabled)
return;
-   }
+
+   crtc->enabled = true;
+}
+
+static void bochs_crtc_disable(struct drm_crtc *crtc)
+{
+   if (!crtc->enabled)
+   return;
+
+   crtc->enabled = false;
 }

 static bool bochs_crtc_mode_fixup(struct drm_crtc *crtc,
@@ -71,7 +75,8 @@ static const struct drm_crtc_funcs bochs_crtc_funcs = {
 };

 static const struct drm_crtc_helper_funcs bochs_helper_funcs = {
-   .dpms = bochs_crtc_dpms,
+   .enable = bochs_crtc_enable,
+   .disable = bochs_crtc_disable,
.mode_fixup = bochs_crtc_mode_fixup,
.mode_set_nofb = bochs_crtc_mode_set_nofb,
.commit = bochs_crtc_commit,
@@ -204,7 +209,11 @@ static void bochs_encoder_mode_set(struct drm_encoder 
*encoder,
 {
 }

-static void bochs_encoder_dpms(struct drm_encoder *encoder, int state)
+static void bochs_encoder_enable(struct drm_encoder *encoder)
+{
+}
+
+static void bochs_encoder_disable(struct drm_encoder *encoder)
 {
 }

@@ -213,7 +222,8 @@ static void bochs_encoder_commit(struct drm_encoder 
*encoder)
 }

 static const struct drm_encoder_helper_funcs bochs_encoder_helper_funcs = {
-   .dpms = bochs_encoder_dpms,
+   .enable = bochs_encoder_enable,
+   .disable = bochs_encoder_disable,
.mode_fixup = bochs_encoder_mode_fixup,
.mode_set = bochs_encoder_mode_set,
.commit = bochs_encoder_commit,
@@ -286,7 +296,7 @@ struct drm_connector_helper_funcs 
bochs_connector_connector_helper_funcs = {
 };

 struct drm_connector_funcs bochs_connector_connector_funcs = {
-   .dpms = drm_helper_connector_dpms,
+   .dpms = drm_atomic_helper_connector_dpms,
.detect = bochs_connector_detect,
.fill_modes = drm_helper_probe_single_connector_modes,
.destroy = drm_connector_cleanup,
-- 
1.7.10.4




[PATCH 7/8] drm/bochs: phase 3: switch to drm_atomic_helper_page_flip

2015-07-16 Thread John Hunter
From: Zhao Junwang 

PageFlips now use the atomic helper to work through the atomic
modesetting API.

v2: -Since driver is now fully atomic, we should add DRIVER_ATOMIC
 to .driver_features.

Cc: Maarten Lankhorst 
Cc: Daniel Vetter 
Signed-off-by: Zhao Junwang 
---
 drivers/gpu/drm/bochs/bochs_drv.c |2 +-
 drivers/gpu/drm/bochs/bochs_kms.c |   22 +-
 2 files changed, 2 insertions(+), 22 deletions(-)

diff --git a/drivers/gpu/drm/bochs/bochs_drv.c 
b/drivers/gpu/drm/bochs/bochs_drv.c
index 98837bd..fc31643 100644
--- a/drivers/gpu/drm/bochs/bochs_drv.c
+++ b/drivers/gpu/drm/bochs/bochs_drv.c
@@ -79,7 +79,7 @@ static const struct file_operations bochs_fops = {
 };

 static struct drm_driver bochs_driver = {
-   .driver_features= DRIVER_GEM | DRIVER_MODESET,
+   .driver_features= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
.load   = bochs_load,
.unload = bochs_unload,
.set_busid  = drm_pci_set_busid,
diff --git a/drivers/gpu/drm/bochs/bochs_kms.c 
b/drivers/gpu/drm/bochs/bochs_kms.c
index f0e93e1..599f367 100644
--- a/drivers/gpu/drm/bochs/bochs_kms.c
+++ b/drivers/gpu/drm/bochs/bochs_kms.c
@@ -59,32 +59,12 @@ static void bochs_crtc_gamma_set(struct drm_crtc *crtc, u16 
*red, u16 *green,
 {
 }

-static int bochs_crtc_page_flip(struct drm_crtc *crtc,
-   struct drm_framebuffer *fb,
-   struct drm_pending_vblank_event *event,
-   uint32_t page_flip_flags)
-{
-   struct bochs_device *bochs =
-   container_of(crtc, struct bochs_device, crtc);
-   struct drm_framebuffer *old_fb = crtc->primary->fb;
-   unsigned long irqflags;
-
-   crtc->primary->fb = fb;
-   drm_helper_crtc_mode_set_base(crtc, 0, 0, old_fb);
-   if (event) {
-   spin_lock_irqsave(>dev->event_lock, irqflags);
-   drm_send_vblank_event(bochs->dev, -1, event);
-   spin_unlock_irqrestore(>dev->event_lock, irqflags);
-   }
-   return 0;
-}
-
 /* These provide the minimum set of functions required to handle a CRTC */
 static const struct drm_crtc_funcs bochs_crtc_funcs = {
.gamma_set = bochs_crtc_gamma_set,
.set_config = drm_atomic_helper_set_config,
.destroy = drm_crtc_cleanup,
-   .page_flip = bochs_crtc_page_flip,
+   .page_flip = drm_atomic_helper_page_flip,
.reset = drm_atomic_helper_crtc_reset,
.atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state,
.atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
-- 
1.7.10.4




[PATCH 6/8] drm/bochs: phase 3: provide a custom ->atomic_commit implementation

2015-07-16 Thread John Hunter
From: Zhao Junwang 

This supports the asynchronous commits, required for page-flipping
Since it's virtual hw it's ok to commit async stuff right away, we
never have to wait for vblank.

Cc: Maarten Lankhorst 
Cc: Daniel Vetter 
Signed-off-by: Zhao Junwang 
---
 drivers/gpu/drm/bochs/bochs_mm.c |9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/bochs/bochs_mm.c b/drivers/gpu/drm/bochs/bochs_mm.c
index c1d819c..37ac2ca 100644
--- a/drivers/gpu/drm/bochs/bochs_mm.c
+++ b/drivers/gpu/drm/bochs/bochs_mm.c
@@ -545,8 +545,15 @@ bochs_user_framebuffer_create(struct drm_device *dev,
return _fb->base;
 }

+static int bochs_atomic_commit(struct drm_device *dev,
+struct drm_atomic_state *a,
+bool async)
+{
+   return drm_atomic_helper_commit(dev, a, false);
+}
+
 const struct drm_mode_config_funcs bochs_mode_funcs = {
.fb_create = bochs_user_framebuffer_create,
.atomic_check = drm_atomic_helper_check,
-   .atomic_commit = drm_atomic_helper_commit,
+   .atomic_commit = bochs_atomic_commit,
 };
-- 
1.7.10.4




[PATCH 5/8] drm/bochs: phase 3: use atomic .set_config helper

2015-07-16 Thread John Hunter
From: Zhao Junwang 

Now that phase 1 and phase 2 are complete, switch .set_config helper
to use the atomic one.

-since .prepare() callbacks are no more needed, remove them
-.mode_set() and .mode_set_base() are no longer needed, remove

-as we are not using the transitional helper now, we can use the
 drm_atomic_helper_plane_check_update this time.

Cc: Maarten Lankhorst 
Cc: Daniel Vetter 
Signed-off-by: Zhao Junwang 
---
 drivers/gpu/drm/bochs/bochs_kms.c |   24 ++--
 1 file changed, 10 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/bochs/bochs_kms.c 
b/drivers/gpu/drm/bochs/bochs_kms.c
index 2d2de7c..f0e93e1 100644
--- a/drivers/gpu/drm/bochs/bochs_kms.c
+++ b/drivers/gpu/drm/bochs/bochs_kms.c
@@ -50,10 +50,6 @@ static void bochs_crtc_mode_set_nofb(struct drm_crtc *crtc)
bochs_hw_setmode(bochs, >mode);
 }

-static void bochs_crtc_prepare(struct drm_crtc *crtc)
-{
-}
-
 static void bochs_crtc_commit(struct drm_crtc *crtc)
 {
 }
@@ -86,7 +82,7 @@ static int bochs_crtc_page_flip(struct drm_crtc *crtc,
 /* These provide the minimum set of functions required to handle a CRTC */
 static const struct drm_crtc_funcs bochs_crtc_funcs = {
.gamma_set = bochs_crtc_gamma_set,
-   .set_config = drm_crtc_helper_set_config,
+   .set_config = drm_atomic_helper_set_config,
.destroy = drm_crtc_cleanup,
.page_flip = bochs_crtc_page_flip,
.reset = drm_atomic_helper_crtc_reset,
@@ -97,10 +93,7 @@ static const struct drm_crtc_funcs bochs_crtc_funcs = {
 static const struct drm_crtc_helper_funcs bochs_helper_funcs = {
.dpms = bochs_crtc_dpms,
.mode_fixup = bochs_crtc_mode_fixup,
-   .mode_set = drm_helper_crtc_mode_set,
-   .mode_set_base = drm_helper_crtc_mode_set_base,
.mode_set_nofb = bochs_crtc_mode_set_nofb,
-   .prepare = bochs_crtc_prepare,
.commit = bochs_crtc_commit,
 };

@@ -162,7 +155,15 @@ static void bochs_plane_cleanup_fb(struct drm_plane *plane,
 static int bochs_plane_atomic_check(struct drm_plane *plane,
struct drm_plane_state *plane_state)
 {
-   return 0;
+   bool visible;
+
+   if (!plane_state->fb)
+   return 0;
+
+   return drm_atomic_helper_plane_check_update(plane_state,
+   DRM_PLANE_HELPER_NO_SCALING,
+   DRM_PLANE_HELPER_NO_SCALING,
+   false, );
 }

 static void bochs_plane_atomic_update(struct drm_plane *plane,
@@ -227,10 +228,6 @@ static void bochs_encoder_dpms(struct drm_encoder 
*encoder, int state)
 {
 }

-static void bochs_encoder_prepare(struct drm_encoder *encoder)
-{
-}
-
 static void bochs_encoder_commit(struct drm_encoder *encoder)
 {
 }
@@ -239,7 +236,6 @@ static const struct drm_encoder_helper_funcs 
bochs_encoder_helper_funcs = {
.dpms = bochs_encoder_dpms,
.mode_fixup = bochs_encoder_mode_fixup,
.mode_set = bochs_encoder_mode_set,
-   .prepare = bochs_encoder_prepare,
.commit = bochs_encoder_commit,
 };

-- 
1.7.10.4




[PATCH 4/8] drm/bochs: phase 3: for plane updates: switch to atomic helper internally

2015-07-16 Thread John Hunter
From: Zhao Junwang 

- planes:
drm_atomic_helper_update_plane()
drm_atomic_helper_diable_plane()
- Driver:
drm_atomic_helper_check()
drm_atomic_helper_commit()

Cc: Maarten Lankhorst 
Cc: Daniel Vetter 
Signed-off-by: Zhao Junwang 
---
 drivers/gpu/drm/bochs/bochs_kms.c |4 ++--
 drivers/gpu/drm/bochs/bochs_mm.c  |2 ++
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/bochs/bochs_kms.c 
b/drivers/gpu/drm/bochs/bochs_kms.c
index e5fa125..2d2de7c 100644
--- a/drivers/gpu/drm/bochs/bochs_kms.c
+++ b/drivers/gpu/drm/bochs/bochs_kms.c
@@ -177,8 +177,8 @@ static void bochs_plane_atomic_update(struct drm_plane 
*plane,
 }

 static const struct drm_plane_funcs bochs_plane_funcs = {
-   .update_plane = drm_plane_helper_update,
-   .disable_plane = drm_plane_helper_disable,
+   .update_plane = drm_atomic_helper_update_plane,
+   .disable_plane = drm_atomic_helper_disable_plane,
.reset = drm_atomic_helper_plane_reset,
.atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state,
.atomic_destroy_state = drm_atomic_helper_plane_destroy_state,
diff --git a/drivers/gpu/drm/bochs/bochs_mm.c b/drivers/gpu/drm/bochs/bochs_mm.c
index 66286ff..c1d819c 100644
--- a/drivers/gpu/drm/bochs/bochs_mm.c
+++ b/drivers/gpu/drm/bochs/bochs_mm.c
@@ -547,4 +547,6 @@ bochs_user_framebuffer_create(struct drm_device *dev,

 const struct drm_mode_config_funcs bochs_mode_funcs = {
.fb_create = bochs_user_framebuffer_create,
+   .atomic_check = drm_atomic_helper_check,
+   .atomic_commit = drm_atomic_helper_commit,
 };
-- 
1.7.10.4




[PATCH 3/8] drm/bochs: stop looking at legacy state

2015-07-16 Thread John Hunter
From: Zhao Junwang 

with transitional helpers we've used the new callbacks, but control
flow was still old, but with atomic first step is to call atomic_check,
then prepare_fb, and so on, by this time, we can not look at any legacy
state like plane->fb or crtc->enabled, because they are updated at the
very end.

Cc: Maarten Lankhorst 
Cc: Daniel Vetter 
Signed-off-by: Zhao Junwang 
---
 drivers/gpu/drm/bochs/bochs_kms.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/bochs/bochs_kms.c 
b/drivers/gpu/drm/bochs/bochs_kms.c
index a14bac4..e5fa125 100644
--- a/drivers/gpu/drm/bochs/bochs_kms.c
+++ b/drivers/gpu/drm/bochs/bochs_kms.c
@@ -123,10 +123,10 @@ static int bochs_plane_prepare_fb(struct drm_plane *plane,
struct bochs_bo *bo;
int ret;

-   if (WARN_ON(plane->fb == NULL))
+   if (WARN_ON(fb == NULL))
return -EINVAL;

-   bochs_fb = to_bochs_framebuffer(plane->fb);
+   bochs_fb = to_bochs_framebuffer(fb);
bo = gem_to_bochs_bo(bochs_fb->obj);
ttm_bo_reserve(>bo, true, false, false, NULL);

-- 
1.7.10.4




[PATCH 2/8] drm/bochs: phase 2: wire up state reset(), duplicate() and destroy

2015-07-16 Thread John Hunter
From: Zhao Junwang 

Set CRTC, planes and connectors to use the default implementations
from the atomic helper library.

Cc: Maarten Lankhorst 
Cc: Daniel Vetter 
Signed-off-by: Zhao Junwang 
---
 drivers/gpu/drm/bochs/bochs_kms.c |   12 
 1 file changed, 12 insertions(+)

diff --git a/drivers/gpu/drm/bochs/bochs_kms.c 
b/drivers/gpu/drm/bochs/bochs_kms.c
index 1b66dd3..a14bac4 100644
--- a/drivers/gpu/drm/bochs/bochs_kms.c
+++ b/drivers/gpu/drm/bochs/bochs_kms.c
@@ -89,6 +89,9 @@ static const struct drm_crtc_funcs bochs_crtc_funcs = {
.set_config = drm_crtc_helper_set_config,
.destroy = drm_crtc_cleanup,
.page_flip = bochs_crtc_page_flip,
+   .reset = drm_atomic_helper_crtc_reset,
+   .atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state,
+   .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
 };

 static const struct drm_crtc_helper_funcs bochs_helper_funcs = {
@@ -176,6 +179,9 @@ static void bochs_plane_atomic_update(struct drm_plane 
*plane,
 static const struct drm_plane_funcs bochs_plane_funcs = {
.update_plane = drm_plane_helper_update,
.disable_plane = drm_plane_helper_disable,
+   .reset = drm_atomic_helper_plane_reset,
+   .atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state,
+   .atomic_destroy_state = drm_atomic_helper_plane_destroy_state,
 };

 static const struct drm_plane_helper_funcs bochs_plane_helper_funcs = {
@@ -308,6 +314,9 @@ struct drm_connector_funcs bochs_connector_connector_funcs 
= {
.detect = bochs_connector_detect,
.fill_modes = drm_helper_probe_single_connector_modes,
.destroy = drm_connector_cleanup,
+   .reset = drm_atomic_helper_connector_reset,
+   .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
+   .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
 };

 static void bochs_connector_init(struct drm_device *dev)
@@ -341,6 +350,9 @@ int bochs_kms_init(struct bochs_device *bochs)
bochs_crtc_init(bochs->dev);
bochs_encoder_init(bochs->dev);
bochs_connector_init(bochs->dev);
+
+   drm_mode_config_reset(bochs->dev);
+
drm_mode_connector_attach_encoder(>connector,
  >encoder);

-- 
1.7.10.4




[PATCH 1/8] drm/bochs: phase 1 - use the transitional helpers

2015-07-16 Thread John Hunter
From: Zhao Junwang 

-register driver's own primary plane
-use drm_crtc_init_with_planes instead of drm_crtc_init

-split ->mode_set into:
1. set the new hw mode
2. update the primary plane (This is done by ->set_base)
-move what ->set_base do into ->atomic_update

-the new atomic infrastructure needs the ->mode_set_nofb callback
 to update CRTC timings before setting any plane

-since the ->cleanup_fb can't fail, set the interruptible argument
 of the ttm_bo_reserve to false, this make sure the ttm_bo_reserve
 can't fail

v2: -add a few checks to plane's ->atomic_check, using
 drm_plane_helper_check_update

v3: -polish the atomic_check, it does too much in v2, remove the
 ->disable_plane and ->set_config

v4: -use plane->state instead of old_state in
 bochs_plane_atomic_update

v5: -just return 0 in plane ->atomic_check, i.e. remove what we
 do in v2-v4

Cc: Maarten Lankhorst 
Cc: Daniel Vetter 
Signed-off-by: Zhao Junwang 
---
 drivers/gpu/drm/bochs/bochs.h |2 +
 drivers/gpu/drm/bochs/bochs_kms.c |  159 -
 2 files changed, 108 insertions(+), 53 deletions(-)

diff --git a/drivers/gpu/drm/bochs/bochs.h b/drivers/gpu/drm/bochs/bochs.h
index 71f2687..2f10480 100644
--- a/drivers/gpu/drm/bochs/bochs.h
+++ b/drivers/gpu/drm/bochs/bochs.h
@@ -5,6 +5,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 

 #include 
@@ -72,6 +73,7 @@ struct bochs_device {

/* drm */
struct drm_device  *dev;
+   struct drm_plane primary;
struct drm_crtc crtc;
struct drm_encoder encoder;
struct drm_connector connector;
diff --git a/drivers/gpu/drm/bochs/bochs_kms.c 
b/drivers/gpu/drm/bochs/bochs_kms.c
index 26bcd03..1b66dd3 100644
--- a/drivers/gpu/drm/bochs/bochs_kms.c
+++ b/drivers/gpu/drm/bochs/bochs_kms.c
@@ -10,6 +10,11 @@

 static int defx = 1024;
 static int defy = 768;
+static u64 gpu_addr = 0;
+
+static const uint32_t bochs_primary_formats[] = {
+   DRM_FORMAT_XRGB,
+};

 module_param(defx, int, 0444);
 module_param(defy, int, 0444);
@@ -37,59 +42,12 @@ static bool bochs_crtc_mode_fixup(struct drm_crtc *crtc,
return true;
 }

-static int bochs_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,
-   struct drm_framebuffer *old_fb)
+static void bochs_crtc_mode_set_nofb(struct drm_crtc *crtc)
 {
struct bochs_device *bochs =
container_of(crtc, struct bochs_device, crtc);
-   struct bochs_framebuffer *bochs_fb;
-   struct bochs_bo *bo;
-   u64 gpu_addr = 0;
-   int ret;

-   if (old_fb) {
-   bochs_fb = to_bochs_framebuffer(old_fb);
-   bo = gem_to_bochs_bo(bochs_fb->obj);
-   ret = ttm_bo_reserve(>bo, true, false, false, NULL);
-   if (ret) {
-   DRM_ERROR("failed to reserve old_fb bo\n");
-   } else {
-   bochs_bo_unpin(bo);
-   ttm_bo_unreserve(>bo);
-   }
-   }
-
-   if (WARN_ON(crtc->primary->fb == NULL))
-   return -EINVAL;
-
-   bochs_fb = to_bochs_framebuffer(crtc->primary->fb);
-   bo = gem_to_bochs_bo(bochs_fb->obj);
-   ret = ttm_bo_reserve(>bo, true, false, false, NULL);
-   if (ret)
-   return ret;
-
-   ret = bochs_bo_pin(bo, TTM_PL_FLAG_VRAM, _addr);
-   if (ret) {
-   ttm_bo_unreserve(>bo);
-   return ret;
-   }
-
-   ttm_bo_unreserve(>bo);
-   bochs_hw_setbase(bochs, x, y, gpu_addr);
-   return 0;
-}
-
-static int bochs_crtc_mode_set(struct drm_crtc *crtc,
-  struct drm_display_mode *mode,
-  struct drm_display_mode *adjusted_mode,
-  int x, int y, struct drm_framebuffer *old_fb)
-{
-   struct bochs_device *bochs =
-   container_of(crtc, struct bochs_device, crtc);
-
-   bochs_hw_setmode(bochs, mode);
-   bochs_crtc_mode_set_base(crtc, x, y, old_fb);
-   return 0;
+   bochs_hw_setmode(bochs, >mode);
 }

 static void bochs_crtc_prepare(struct drm_crtc *crtc)
@@ -116,7 +74,7 @@ static int bochs_crtc_page_flip(struct drm_crtc *crtc,
unsigned long irqflags;

crtc->primary->fb = fb;
-   bochs_crtc_mode_set_base(crtc, 0, 0, old_fb);
+   drm_helper_crtc_mode_set_base(crtc, 0, 0, old_fb);
if (event) {
spin_lock_irqsave(>dev->event_lock, irqflags);
drm_send_vblank_event(bochs->dev, -1, event);
@@ -136,8 +94,9 @@ static const struct drm_crtc_funcs bochs_crtc_funcs = {
 static const struct drm_crtc_helper_funcs bochs_helper_funcs = {
.dpms = bochs_crtc_dpms,
.mode_fixup = bochs_crtc_mode_fixup,
-   .mode_set = bochs_crtc_mode_set,
-   .mode_set_base = bochs_crtc_mode_set_base,
+   .mode_set = drm_helper_crtc_mode_set,
+   .mode_set_base = 

[PATCH 0/8] drm/bochs: convert bochs to atomic mode-setting

2015-07-16 Thread John Hunter
From: Zhao Junwang 

This patch series aim to convert DRM_BOCHS to atomic mode-setting.
I did this mostly reference Gustavo Padovan's patch series on
drm/exynos conversion.

Zhao Junwang (8):
  drm/bochs: phase 1 - use the transitional helpers
  drm/bochs: phase 2: wire up state reset(), duplicate() and destroy
  drm/bochs: stop looking at legacy state
  drm/bochs: phase 3: for plane updates: switch to atomic helper
internally
  drm/bochs: phase 3: use atomic .set_config helper
  drm/bochs: phase 3: provide a custom ->atomic_commit implementation
  drm/bochs: phase 3: switch to drm_atomic_helper_page_flip
  drm/bochs: atomic dpms support

 drivers/gpu/drm/bochs/bochs.h |2 +
 drivers/gpu/drm/bochs/bochs_drv.c |2 +-
 drivers/gpu/drm/bochs/bochs_kms.c |  221 +++--
 drivers/gpu/drm/bochs/bochs_mm.c  |9 ++
 4 files changed, 148 insertions(+), 86 deletions(-)

-- 
1.7.10.4




[PATCH v3] drm: add a drm_atomic_helper_plane_check_update

2015-07-14 Thread John Hunter
From: Zhao Junwang 

This is the equivalent helper to drm_plane_helper_check_update
for legacy drivers, but using atomic state to check things.

Motivated by the atomic conversion of the bochs driver.

v2: according to Daniel's comment
-polish the kerneldoc comment to match the signatures
-crtc->mode is legacy state, we need to look at crtc_state
 instead

according to Maarten's comment
-there is no need for can_update_disabled in the atomic world,
 so, we can delete that parameter

v3: according to Daniel's comment
-this function call can't fail, add a WARN_ON
-use drm_atomic_get_existing_crtc_state

according to Maarten's comment
-kill off the plane parameter and rename state to plane_state
-do not handling NULL, i.e. no need to check plane_state in
 atomic.

v4: -get rid of IS_ERR, IS_ERR actually doesn't catch NULL pointers

Cc: Maarten Lankhorst 
Cc: Daniel Vetter 
Signed-off-by: Zhao Junwang 
---
 drivers/gpu/drm/drm_atomic_helper.c |   56 +++
 drivers/gpu/drm/drm_plane_helper.c  |6 
 include/drm/drm_atomic_helper.h |5 
 3 files changed, 67 insertions(+)

diff --git a/drivers/gpu/drm/drm_atomic_helper.c 
b/drivers/gpu/drm/drm_atomic_helper.c
index 536ae4d..e492ff8 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -1336,6 +1336,62 @@ void drm_atomic_helper_swap_state(struct drm_device *dev,
 EXPORT_SYMBOL(drm_atomic_helper_swap_state);

 /**
+ * drm_atomic_helper_plane_check_update
+ * @plane_state: drm plane state
+ * @min_scale: minimum @src:@dest scaling factor in 16.16 fixed point
+ * @max_scale: maximum @src:@dest scaling factor in 16.16 fixed point
+ * @can_position: is it legal to position the plane such that it
+ *doesn't cover the entire crtc?  This will generally
+ *only be false for primary planes.
+ *
+ * This provides a helper to be used in a driver's plane atomic_check
+ * callback. It is the atomic equivalent of
+ * drm_plane_helper_check_update() and has the exact same semantics,
+ * except that it looks at the atomic CRTC state in the atomic update
+ * instead of legacy state directly embedded in struct _crtc.
+ *
+ * RETURNS:
+ * Zero on success, error code on failure
+ */
+int drm_atomic_helper_plane_check_update(struct drm_plane_state *plane_state,
+int min_scale,
+int max_scale,
+bool can_position,
+bool *visible)
+{
+   struct drm_crtc_state *crtc_state;
+   crtc_state = drm_atomic_get_existing_crtc_state(plane_state->state,
+   plane_state->crtc);
+   if (WARN_ON(!crtc_state))
+   return -EBUSY;
+
+   struct drm_rect src = {
+   .x1 = plane_state->src_x,
+   .y1 = plane_state->src_y,
+   .x2 = plane_state->src_x + plane_state->src_w,
+   .y2 = plane_state->src_y + plane_state->src_h,
+   };
+   struct drm_rect dest = {
+   .x1 = plane_state->crtc_x,
+   .y1 = plane_state->crtc_y,
+   .x2 = plane_state->crtc_x + plane_state->crtc_w,
+   .y2 = plane_state->crtc_y + plane_state->crtc_h,
+   };
+   const struct drm_rect clip = {
+   .x2 = crtc_state->mode.hdisplay,
+   .y2 = crtc_state->mode.vdisplay,
+   };
+
+   return drm_plane_helper_check_update(plane_state->plane,
+plane_state->crtc,
+plane_state->fb,
+, , ,
+min_scale, max_scale,
+can_position, true, visible);
+}
+EXPORT_SYMBOL(drm_atomic_helper_plane_check_update);
+
+/**
  * drm_atomic_helper_update_plane - Helper for primary plane update using 
atomic
  * @plane: plane object to update
  * @crtc: owning CRTC of owning plane
diff --git a/drivers/gpu/drm/drm_plane_helper.c 
b/drivers/gpu/drm/drm_plane_helper.c
index 10be2d2..e346fe2 100644
--- a/drivers/gpu/drm/drm_plane_helper.c
+++ b/drivers/gpu/drm/drm_plane_helper.c
@@ -125,6 +125,12 @@ static int get_connectors_for_crtc(struct drm_crtc *crtc,
  * still wish to call this function to avoid duplication of error checking
  * code.
  *
+ * Note: When converting over to atomic drivers you need to switch
+ * over to using drm_atomic_helper_plane_check_update() since only
+ * that correctly checks atomic state - this function here only looks
+ * at legacy state and hence will check against stale values in
+ * atomic updates.
+ *
  * RETURNS:
  * Zero if update appears valid, error code on failure
  */
diff --git a/include/drm/drm_atomic_helper.h b/include/drm/drm_atomic_helper.h
index 

[PATCH v2] drm: add a drm_atomic_helper_plane_check_update

2015-07-13 Thread John Hunter
From: Zhao Junwang 

This is the equivalent helper to drm_plane_helper_check_update
for legacy drivers, but using atomic state to check things.

Motivated by the atomic conversion of the bochs driver.

v2: according to Daniel's comment
-polish the kerneldoc comment to match the signatures
-crtc->mode is legacy state, we need to look at crtc_state
 instead

according to Maarten's comment
-there is no need for can_update_disabled in the atomic world,
 so, we can delete that parameter

v3: according to Daniel's comment
-this function call can't fail, add a WARN_ON
-use drm_atomic_get_existing_crtc_state

according to Maarten's comment
-kill off the plane parameter and rename state to plane_state
-do not handling NULL, i.e. no need to check plane_state in
 atomic.

Cc: Maarten Lankhorst 
Cc: Daniel Vetter 
Signed-off-by: Zhao Junwang 
---
 drivers/gpu/drm/drm_atomic_helper.c |   56 +++
 drivers/gpu/drm/drm_plane_helper.c  |6 
 include/drm/drm_atomic_helper.h |5 
 3 files changed, 67 insertions(+)

diff --git a/drivers/gpu/drm/drm_atomic_helper.c 
b/drivers/gpu/drm/drm_atomic_helper.c
index 536ae4d..eaef689 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -1336,6 +1336,62 @@ void drm_atomic_helper_swap_state(struct drm_device *dev,
 EXPORT_SYMBOL(drm_atomic_helper_swap_state);

 /**
+ * drm_atomic_helper_plane_check_update
+ * @plane_state: drm plane state
+ * @min_scale: minimum @src:@dest scaling factor in 16.16 fixed point
+ * @max_scale: maximum @src:@dest scaling factor in 16.16 fixed point
+ * @can_position: is it legal to position the plane such that it
+ *doesn't cover the entire crtc?  This will generally
+ *only be false for primary planes.
+ *
+ * This provides a helper to be used in a driver's plane atomic_check
+ * callback. It is the atomic equivalent of
+ * drm_plane_helper_check_update() and has the exact same semantics,
+ * except that it looks at the atomic CRTC state in the atomic update
+ * instead of legacy state directly embedded in struct _crtc.
+ *
+ * RETURNS:
+ * Zero on success, error code on failure
+ */
+int drm_atomic_helper_plane_check_update(struct drm_plane_state *plane_state,
+int min_scale,
+int max_scale,
+bool can_position,
+bool *visible)
+{
+   struct drm_crtc_state *crtc_state;
+   crtc_state = drm_atomic_get_existing_crtc_state(plane_state->state,
+   plane_state->crtc);
+   if (WARN_ON(IS_ERR(crtc_state)))
+   return PTR_ERR(crtc_state);
+
+   struct drm_rect src = {
+   .x1 = plane_state->src_x,
+   .y1 = plane_state->src_y,
+   .x2 = plane_state->src_x + plane_state->src_w,
+   .y2 = plane_state->src_y + plane_state->src_h,
+   };
+   struct drm_rect dest = {
+   .x1 = plane_state->crtc_x,
+   .y1 = plane_state->crtc_y,
+   .x2 = plane_state->crtc_x + plane_state->crtc_w,
+   .y2 = plane_state->crtc_y + plane_state->crtc_h,
+   };
+   const struct drm_rect clip = {
+   .x2 = crtc_state->mode.hdisplay,
+   .y2 = crtc_state->mode.vdisplay,
+   };
+
+   return drm_plane_helper_check_update(plane_state->plane,
+plane_state->crtc,
+plane_state->fb,
+, , ,
+min_scale, max_scale,
+can_position, true, visible);
+}
+EXPORT_SYMBOL(drm_atomic_helper_plane_check_update);
+
+/**
  * drm_atomic_helper_update_plane - Helper for primary plane update using 
atomic
  * @plane: plane object to update
  * @crtc: owning CRTC of owning plane
diff --git a/drivers/gpu/drm/drm_plane_helper.c 
b/drivers/gpu/drm/drm_plane_helper.c
index 10be2d2..e346fe2 100644
--- a/drivers/gpu/drm/drm_plane_helper.c
+++ b/drivers/gpu/drm/drm_plane_helper.c
@@ -125,6 +125,12 @@ static int get_connectors_for_crtc(struct drm_crtc *crtc,
  * still wish to call this function to avoid duplication of error checking
  * code.
  *
+ * Note: When converting over to atomic drivers you need to switch
+ * over to using drm_atomic_helper_plane_check_update() since only
+ * that correctly checks atomic state - this function here only looks
+ * at legacy state and hence will check against stale values in
+ * atomic updates.
+ *
  * RETURNS:
  * Zero if update appears valid, error code on failure
  */
diff --git a/include/drm/drm_atomic_helper.h b/include/drm/drm_atomic_helper.h
index cc1fee8..eaa2544 100644
--- 

[PATCH] drm: add a drm_atomic_helper_plane_check_update

2015-07-13 Thread John Hunter
From: Zhao Junwang 

This is the equivalent helper to drm_plane_helper_check_update
for legacy drivers, but using atomic state to check things.

Motivated by the atomic conversion of the bochs driver.

v2: according to Daniel's comment
-polish the kerneldoc comment to match the signatures
-crtc->mode is legacy state, we need to look at crtc_state
 instead

according to Maarten's comment
-there is no need for can_update_disabled in the atomic world,
 so, we can delete that parameter

v3: according to Daniel's comment
-this function call can't fail, add a WARN_ON
-use drm_atomic_get_existing_crtc_state

according to Maarten's comment
-kill off the plane parameter and rename state to plane_state
-do not handling NULL, i.e. no need to check plane_state in
 atomic.

Cc: Maarten Lankhorst 
Cc: Daniel Vetter 
Signed-off-by: Zhao Junwang 
---
 drivers/gpu/drm/drm_atomic_helper.c |   56 +++
 drivers/gpu/drm/drm_plane_helper.c  |6 
 include/drm/drm_atomic_helper.h |5 
 3 files changed, 67 insertions(+)

diff --git a/drivers/gpu/drm/drm_atomic_helper.c 
b/drivers/gpu/drm/drm_atomic_helper.c
index 536ae4d..eaef689 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -1336,6 +1336,62 @@ void drm_atomic_helper_swap_state(struct drm_device *dev,
 EXPORT_SYMBOL(drm_atomic_helper_swap_state);

 /**
+ * drm_atomic_helper_plane_check_update
+ * @plane_state: drm plane state
+ * @min_scale: minimum @src:@dest scaling factor in 16.16 fixed point
+ * @max_scale: maximum @src:@dest scaling factor in 16.16 fixed point
+ * @can_position: is it legal to position the plane such that it
+ *doesn't cover the entire crtc?  This will generally
+ *only be false for primary planes.
+ *
+ * This provides a helper to be used in a driver's plane atomic_check
+ * callback. It is the atomic equivalent of
+ * drm_plane_helper_check_update() and has the exact same semantics,
+ * except that it looks at the atomic CRTC state in the atomic update
+ * instead of legacy state directly embedded in struct _crtc.
+ *
+ * RETURNS:
+ * Zero on success, error code on failure
+ */
+int drm_atomic_helper_plane_check_update(struct drm_plane_state *plane_state,
+int min_scale,
+int max_scale,
+bool can_position,
+bool *visible)
+{
+   struct drm_crtc_state *crtc_state;
+   crtc_state = drm_atomic_get_existing_crtc_state(plane_state->state,
+   plane_state->crtc);
+   if (WARN_ON(IS_ERR(crtc_state)))
+   return PTR_ERR(crtc_state);
+
+   struct drm_rect src = {
+   .x1 = plane_state->src_x,
+   .y1 = plane_state->src_y,
+   .x2 = plane_state->src_x + plane_state->src_w,
+   .y2 = plane_state->src_y + plane_state->src_h,
+   };
+   struct drm_rect dest = {
+   .x1 = plane_state->crtc_x,
+   .y1 = plane_state->crtc_y,
+   .x2 = plane_state->crtc_x + plane_state->crtc_w,
+   .y2 = plane_state->crtc_y + plane_state->crtc_h,
+   };
+   const struct drm_rect clip = {
+   .x2 = crtc_state->mode.hdisplay,
+   .y2 = crtc_state->mode.vdisplay,
+   };
+
+   return drm_plane_helper_check_update(plane_state->plane,
+plane_state->crtc,
+plane_state->fb,
+, , ,
+min_scale, max_scale,
+can_position, true, visible);
+}
+EXPORT_SYMBOL(drm_atomic_helper_plane_check_update);
+
+/**
  * drm_atomic_helper_update_plane - Helper for primary plane update using 
atomic
  * @plane: plane object to update
  * @crtc: owning CRTC of owning plane
diff --git a/drivers/gpu/drm/drm_plane_helper.c 
b/drivers/gpu/drm/drm_plane_helper.c
index 10be2d2..e346fe2 100644
--- a/drivers/gpu/drm/drm_plane_helper.c
+++ b/drivers/gpu/drm/drm_plane_helper.c
@@ -125,6 +125,12 @@ static int get_connectors_for_crtc(struct drm_crtc *crtc,
  * still wish to call this function to avoid duplication of error checking
  * code.
  *
+ * Note: When converting over to atomic drivers you need to switch
+ * over to using drm_atomic_helper_plane_check_update() since only
+ * that correctly checks atomic state - this function here only looks
+ * at legacy state and hence will check against stale values in
+ * atomic updates.
+ *
  * RETURNS:
  * Zero if update appears valid, error code on failure
  */
diff --git a/include/drm/drm_atomic_helper.h b/include/drm/drm_atomic_helper.h
index cc1fee8..eaa2544 100644
--- 

[PATCH] drm: add a drm_atomic_helper_plane_check_update

2015-07-13 Thread John Hunter
So we should remove the can_update_disabled parameter, and set it to true
in the drm_plane_helper_check_update callback?

I am still learning the atomic world, pls forgive if I don't understand it
well

On Mon, Jul 13, 2015 at 3:17 PM, Maarten Lankhorst <
maarten.lankhorst at linux.intel.com> wrote:

> Op 13-07-15 om 09:12 schreef Maarten Lankhorst:
> > Op 13-07-15 om 02:21 schreef John Hunter:
> >> From: Zhao Junwang 
> >>
> >> Cc: Daniel Vetter 
> >> Signed-off-by: Zhao Junwang 
> >> ---
> >>  drivers/gpu/drm/drm_atomic_helper.c |   55
> +++
> >>  include/drm/drm_atomic_helper.h |7 +
> >>  2 files changed, 62 insertions(+)
> >>
> >> diff --git a/drivers/gpu/drm/drm_atomic_helper.c
> b/drivers/gpu/drm/drm_atomic_helper.c
> >> index 536ae4d..3d94ff8 100644
> >> --- a/drivers/gpu/drm/drm_atomic_helper.c
> >> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> >> @@ -1336,6 +1336,61 @@ void drm_atomic_helper_swap_state(struct
> drm_device *dev,
> >>  EXPORT_SYMBOL(drm_atomic_helper_swap_state);
> >>
> >>  /**
> >> + * drm_atomic_helper_plane_check_update
> >> + * @plane: plane object to update
> > == plane_state->plane, so can be removed
> >> + * @state: drm plane state
> > rename to plane_state
> >> + * @min_scale: minimum @src:@dest scaling factor in 16.16 fixed point
> >> + * @max_scale: maximum @src:@dest scaling factor in 16.16 fixed point
> >> + * @can_position: is it legal to position the plane such that it
> >> + *doesn't cover the entire crtc?  This will generally
> >> + *only be false for primary planes.
> >> + * @can_update_disabled: can the plane be updated while the crtc
> >> + *   is disabled?
> >> + *
> > If you look carefully at drm_plane_helper_check_update,
> can_update_disabled will be a noop,
> > so remove this parameter.
> >
> > plane_state->crtc != NULL iff plane_state->fb != NULL
> >
> Oops, should check harder before I hit send. You can disable a crtc with
> planes attached, but the clip
> will be bogus in that case. When !crtc->enable the clip will be set { 0,
> 0, 0, 0 }, hiding the plane.
>
> There's still no need for can_update_disabled in the atomic world though,
> the plane state will be properly recalculated during a modeset.
> If you don't want to update a plane while a crtc is disabled, just don't
> update it in your commit function.
>



-- 
Best regards
Junwang Zhao
Microprocessor Research and Develop Center
Department of Computer Science 
Peking University
Beijing, 100871, PRC
-- next part --
An HTML attachment was scrubbed...
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20150713/c892a78b/attachment.html>


[PATCH] drm: add a drm_atomic_helper_plane_check_update

2015-07-13 Thread John Hunter
From: Zhao Junwang 

Cc: Daniel Vetter 
Signed-off-by: Zhao Junwang 
---
 drivers/gpu/drm/drm_atomic_helper.c |   55 +++
 include/drm/drm_atomic_helper.h |7 +
 2 files changed, 62 insertions(+)

diff --git a/drivers/gpu/drm/drm_atomic_helper.c 
b/drivers/gpu/drm/drm_atomic_helper.c
index 536ae4d..3d94ff8 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -1336,6 +1336,61 @@ void drm_atomic_helper_swap_state(struct drm_device *dev,
 EXPORT_SYMBOL(drm_atomic_helper_swap_state);

 /**
+ * drm_atomic_helper_plane_check_update
+ * @plane: plane object to update
+ * @state: drm plane state
+ * @min_scale: minimum @src:@dest scaling factor in 16.16 fixed point
+ * @max_scale: maximum @src:@dest scaling factor in 16.16 fixed point
+ * @can_position: is it legal to position the plane such that it
+ *doesn't cover the entire crtc?  This will generally
+ *only be false for primary planes.
+ * @can_update_disabled: can the plane be updated while the crtc
+ *   is disabled?
+ *
+ * Provide a default plane check update handler
+ *
+ * RETURNS:
+ * Zero on success, error code on failure
+ */
+int drm_atomic_helper_plane_check_update(struct drm_plane *plane,
+struct drm_plane_state *state,
+int min_scale,
+int max_scale,
+bool can_position,
+bool can_update_disabled,
+bool *visible)
+{
+   struct drm_crtc *crtc = state->crtc;
+   struct drm_framebuffer *fb = state->fb;
+
+   if (!fb)
+   return 0;
+
+   struct drm_rect src = {
+   .x1 = state->src_x,
+   .y1 = state->src_y,
+   .x2 = state->src_x + state->src_w,
+   .y2 = state->src_y + state->src_h,
+   };
+   struct drm_rect dest = {
+   .x1 = state->crtc_x,
+   .y1 = state->crtc_y,
+   .x2 = state->crtc_x + state->crtc_w,
+   .y2 = state->crtc_y + state->crtc_h,
+   };
+   const struct drm_rect clip = {
+   .x2 = crtc->mode.hdisplay,
+   .y2 = crtc->mode.vdisplay,
+   };
+
+   return drm_plane_helper_check_update(plane, crtc, fb,
+   , , ,
+   min_scale, max_scale,
+   can_position, can_update_disabled, visible);
+}
+EXPORT_SYMBOL(drm_atomic_helper_plane_check_update);
+
+/**
  * drm_atomic_helper_update_plane - Helper for primary plane update using 
atomic
  * @plane: plane object to update
  * @crtc: owning CRTC of owning plane
diff --git a/include/drm/drm_atomic_helper.h b/include/drm/drm_atomic_helper.h
index cc1fee8..5305a01 100644
--- a/include/drm/drm_atomic_helper.h
+++ b/include/drm/drm_atomic_helper.h
@@ -64,6 +64,13 @@ void drm_atomic_helper_swap_state(struct drm_device *dev,
  struct drm_atomic_state *state);

 /* implementations for legacy interfaces */
+int drm_atomic_helper_plane_check_update(struct drm_plane *plane,
+struct drm_plane_state *state,
+int min_scale,
+int max_scale,
+bool can_position,
+bool can_update_disabled,
+bool *visible);
 int drm_atomic_helper_update_plane(struct drm_plane *plane,
   struct drm_crtc *crtc,
   struct drm_framebuffer *fb,
-- 
1.7.10.4




DRM-vmwgfx: Deletion of an unnecessary check before the function call "vfree"

2015-07-09 Thread John Hunter
On Thu, Jul 9, 2015 at 12:55 AM, SF Markus Elfring <
elfring at users.sourceforge.net> wrote:

> > Reviewed-by: Zhao Junwang 
> >
> > kfree will check that.
>
> How does this feedback fit to a check before a call
> of the vfree() function?
>
> I might have made a mistake, the ctl^] lead me to the vfree in mm/nommu.c,
there is also a vfree() function in mm/vmalloc.c.

Anyway, I think the catch is reasonable.


> Regards,
> Markus
>



-- 
Best regards
Junwang Zhao
Microprocessor Research and Develop Center
Department of Computer Science 
Peking University
Beijing, 100871, PRC
-- next part --
An HTML attachment was scrubbed...
URL: 



[PATCH] drm: sti: add moduleparam to disable fbdev

2015-07-08 Thread John Hunter
On Wed, Jul 8, 2015 at 8:50 PM, Benjamin Gaignard <
benjamin.gaignard at linaro.org> wrote:

> Useful to avoid recompiling to enable/disable fbdev.
>
> Signed-off-by: Benjamin Gaignard 
>

Reviewed-by: Zhao Junwang 

Bochs has the moduleparam for fbdev, lgtm.


> ---
>  drivers/gpu/drm/sti/Kconfig   |  6 --
>  drivers/gpu/drm/sti/sti_drm_drv.c | 13 -
>  2 files changed, 8 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/gpu/drm/sti/Kconfig b/drivers/gpu/drm/sti/Kconfig
> index fbccc10..e3aa5af 100644
> --- a/drivers/gpu/drm/sti/Kconfig
> +++ b/drivers/gpu/drm/sti/Kconfig
> @@ -9,9 +9,3 @@ config DRM_STI
> select FW_LOADER_USER_HELPER_FALLBACK
> help
>   Choose this option to enable DRM on STM stiH41x chipset
> -
> -config DRM_STI_FBDEV
> -   bool "DRM frame buffer device for STMicroelectronics SoC stiH41x
> Serie"
> -   depends on DRM_STI
> -   help
> - Choose this option to enable FBDEV on top of DRM for STM stiH41x
> chipset
> diff --git a/drivers/gpu/drm/sti/sti_drm_drv.c
> b/drivers/gpu/drm/sti/sti_drm_drv.c
> index 59d558b..d0fb54a 100644
> --- a/drivers/gpu/drm/sti/sti_drm_drv.c
> +++ b/drivers/gpu/drm/sti/sti_drm_drv.c
> @@ -30,6 +30,10 @@
>  #define STI_MAX_FB_HEIGHT  4096
>  #define STI_MAX_FB_WIDTH   4096
>
> +static bool fbdev;
> +MODULE_PARM_DESC(fbdev, "Enable fbdev compat layer");
> +module_param(fbdev, bool, S_IRUGO | S_IWUSR);
> +
>  static void sti_drm_atomic_schedule(struct sti_drm_private *private,
>   struct drm_atomic_state *state)
>  {
> @@ -160,11 +164,10 @@ static int sti_drm_load(struct drm_device *dev,
> unsigned long flags)
>
> drm_mode_config_reset(dev);
>
> -#ifdef CONFIG_DRM_STI_FBDEV
> -   drm_fbdev_cma_init(dev, 32,
> -  dev->mode_config.num_crtc,
> -  dev->mode_config.num_connector);
> -#endif
> +   if (fbdev)
> +   drm_fbdev_cma_init(dev, 32, dev->mode_config.num_crtc,
> +  dev->mode_config.num_connector);
> +
> return 0;
>  }
>
> --
> 1.9.1
>
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
>



-- 
Best regards
Junwang Zhao
Microprocessor Research and Develop Center
Department of Computer Science 
Peking University
Beijing, 100871, PRC
-- next part --
An HTML attachment was scrubbed...
URL: 



[PATCH 1/1] DRM-vmwgfx: Deletion of an unnecessary check before the function call "vfree"

2015-07-08 Thread John Hunter
On Mon, Jul 6, 2015 at 4:01 PM, SF Markus Elfring <
elfring at users.sourceforge.net> wrote:

> From: Markus Elfring 
> Date: Mon, 6 Jul 2015 09:49:11 +0200
>
> The vfree() function performs also input parameter validation.
> Thus the test around the call is not needed.
>
> This issue was detected by using the Coccinelle software.
>
> Signed-off-by: Markus Elfring 
>

Reviewed-by: Zhao Junwang 

kfree will check that.

> ---
>  drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
> b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
> index 654c8da..f718a6d 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
> @@ -2292,9 +2292,7 @@ static int vmw_resize_cmd_bounce(struct
> vmw_sw_context *sw_context,
>(sw_context->cmd_bounce_size >> 1));
> }
>
> -   if (sw_context->cmd_bounce != NULL)
> -   vfree(sw_context->cmd_bounce);
> -
> +   vfree(sw_context->cmd_bounce);
> sw_context->cmd_bounce = vmalloc(sw_context->cmd_bounce_size);
>
> if (sw_context->cmd_bounce == NULL) {
> --
> 2.4.5
>
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
>



-- 
Best regards
Junwang Zhao
Microprocessor Research and Develop Center
Department of Computer Science 
Peking University
Beijing, 100871, PRC
-- next part --
An HTML attachment was scrubbed...
URL: 



[PATCH v2] drm: add a check for x/y in drm_mode_setcrtc

2015-07-07 Thread John Hunter
From: Zhao Junwang 

legacy setcrtc ioctl does take a 32 bit value which might indeed
overflow

the checks of crtc_req->x > INT_MAX and crtc_req->y > INT_MAX aren't
needed any more with this

v2: -polish the annotation according to Daniel's comment

Cc: Daniel Vetter 
Signed-off-by: Zhao Junwang 
---
 drivers/gpu/drm/drm_crtc.c |7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index b69ed97..745fc78 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -2706,8 +2706,11 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
if (!drm_core_check_feature(dev, DRIVER_MODESET))
return -EINVAL;

-   /* For some reason crtc x/y offsets are signed internally. */
-   if (crtc_req->x > INT_MAX || crtc_req->y > INT_MAX)
+   /*
+* Universal plane src offsets are only 16.16, prevent havoc for
+* drivers using universal plane code internally.
+*/
+   if (crtc_req->x & 0x || crtc_req->y & 0x)
return -ERANGE;

drm_modeset_lock_all(dev);
-- 
1.7.10.4




[PATCH] drm: add a check for x/y in drm_mode_setcrtc

2015-07-07 Thread John Hunter
From: Zhao Junwang 

legacy setcrtc ioctl does take a 32 bit value which might indeed
overflow

the checks of crtc_req->x > INT_MAX and crtc_req->y > INT_MAX aren't
needed any more with this

Cc: Daniel Vetter 
Signed-off-by: Zhao Junwang 
---
 drivers/gpu/drm/drm_crtc.c |7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index b69ed97..c307435 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -2706,8 +2706,11 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
if (!drm_core_check_feature(dev, DRIVER_MODESET))
return -EINVAL;

-   /* For some reason crtc x/y offsets are signed internally. */
-   if (crtc_req->x > INT_MAX || crtc_req->y > INT_MAX)
+   /*
+* Legacy setcrtc ioctl does take a 32 bit value which might
+* overflow
+*/
+   if (crtc_req->x & 0x || crtc_req->y & 0x)
return -ERANGE;

drm_modeset_lock_all(dev);
-- 
1.7.10.4




[PATCH] GPU-DRM: Delete an unnecessary check before drm_property_unreference_blob()

2015-07-06 Thread John Hunter
On Mon, Jul 6, 2015 at 4:00 AM, SF Markus Elfring <
elfring at users.sourceforge.net> wrote:

> From: Markus Elfring 
> Date: Sun, 5 Jul 2015 21:55:10 +0200
>
> The drm_property_unreference_blob() function tests whether its argument
> is NULL and then returns immediately.
> Thus the test around the call is not needed.
>
> This issue was detected by using the Coccinelle software.
>
> Signed-off-by: Markus Elfring 
>

Reviewed-by: Zhao Junwang 

> ---
>  drivers/gpu/drm/drm_crtc.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> index 2d57fc5..6e4c8b0 100644
> --- a/drivers/gpu/drm/drm_crtc.c
> +++ b/drivers/gpu/drm/drm_crtc.c
> @@ -4469,9 +4469,7 @@ static int drm_property_replace_global_blob(struct
> drm_device *dev,
> goto err_created;
> }
>
> -   if (old_blob)
> -   drm_property_unreference_blob(old_blob);
> -
> +   drm_property_unreference_blob(old_blob);
> *replace = new_blob;
>
> return 0;
> --
> 2.4.5
>
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
>



-- 
Best regards
Junwang Zhao
Microprocessor Research and Develop Center
Department of Computer Science 
Peking University
Beijing, 100871, PRC
-- next part --
An HTML attachment was scrubbed...
URL: 



[PATCH] drm/crtc-helper: Fixup error handling in drm_helper_crtc_mode_set

2015-07-02 Thread John Hunter
On Thu, Jul 2, 2015 at 9:16 PM, Daniel Vetter 
wrote:

> In
>
> commit 9f658b7b62e7aefc1ee067136126eca3f58cabfd
> Author: Daniel Stone 
> Date:   Fri May 22 13:34:45 2015 +0100
>
> drm/crtc_helper: Replace open-coded CRTC state helpers
>
> error handling code was broken, resulting in the first path not being
> checked correctly. Fix this by using the same pattern as in the
> transitional plane helper function drm_plane_helper_update.
>
> v2: Simplify the cleanup code while at it too.
>
> v3: After some debugging with John we realized that the above patch
> from Daniel also accidentally removed the if (crtc_state) check. This
> is legal when transitioning to atomic, when the initial state reset
> isn't all wired up yet properly. Reinstate that check to fix the bug
> John has hit.
>
> Cc: Daniel Stone 
> CC: Sean Paul 
> Cc: John Hunter 
> Reported-by: John Hunter 
> Signed-off-by: Daniel Vetter 
>
Tested-by: Zhao Junwang 

> ---
>  drivers/gpu/drm/drm_crtc_helper.c | 24 +++-
>  1 file changed, 11 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_crtc_helper.c
> b/drivers/gpu/drm/drm_crtc_helper.c
> index 393114df88a3..93104f3555f5 100644
> --- a/drivers/gpu/drm/drm_crtc_helper.c
> +++ b/drivers/gpu/drm/drm_crtc_helper.c
> @@ -927,15 +927,13 @@ int drm_helper_crtc_mode_set(struct drm_crtc *crtc,
> struct drm_display_mode *mod
>
> if (crtc->funcs->atomic_duplicate_state)
> crtc_state = crtc->funcs->atomic_duplicate_state(crtc);
> -   else {
> +   else if (crtc->state)
> +   crtc_state = drm_atomic_helper_crtc_duplicate_state(crtc);
> +   else
> crtc_state = kzalloc(sizeof(*crtc_state), GFP_KERNEL);
> -   if (!crtc_state)
> -   return -ENOMEM;
> -   if (crtc->state)
> -   __drm_atomic_helper_crtc_duplicate_state(crtc,
> crtc_state);
> -   else
> -   crtc_state->crtc = crtc;
> -   }
> +
> +   if (!crtc_state)
> +   return -ENOMEM;
>
> crtc_state->planes_changed = true;
> crtc_state->mode_changed = true;
> @@ -957,11 +955,11 @@ int drm_helper_crtc_mode_set(struct drm_crtc *crtc,
> struct drm_display_mode *mod
> ret = drm_helper_crtc_mode_set_base(crtc, x, y, old_fb);
>
>  out:
> -   if (crtc->funcs->atomic_destroy_state)
> -   crtc->funcs->atomic_destroy_state(crtc, crtc_state);
> -   else {
> -   __drm_atomic_helper_crtc_destroy_state(crtc, crtc_state);
> -   kfree(crtc_state);
> +   if (crtc_state) {
> +   if (crtc->funcs->atomic_destroy_state)
> +   crtc->funcs->atomic_destroy_state(crtc,
> crtc_state);
> +   else
> +   drm_atomic_helper_crtc_destroy_state(crtc,
> crtc_state);
> }
>
> return ret;
> --
> 2.1.4
>
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
>



-- 
Best regards
Junwang Zhao
Microprocessor Research and Develop Center
Department of Computer Science 
Peking University
Beijing, 100871, PRC
-- next part --
An HTML attachment was scrubbed...
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20150702/b45330b4/attachment.html>


[PATCH] drm: reset empty state in transitional helpers

2015-07-02 Thread John Hunter
On Thu, Jul 2, 2015 at 10:33 PM, Daniel Vetter 
wrote:

> Transitional drivers might not have all the state frobbing lined up
> yet. But since the initial code has been merged a lot more state was
> added, so we really need this.
>
> Cc: Daniel Stone 
> Signed-off-by: Daniel Vetter 
>
Tested-by: Zhao Junwang 

> ---
>  drivers/gpu/drm/drm_crtc_helper.c  |  8 +---
>  drivers/gpu/drm/drm_plane_helper.c | 16 ++--
>  2 files changed, 15 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_crtc_helper.c
> b/drivers/gpu/drm/drm_crtc_helper.c
> index 93104f3555f5..d3dfb0ebbeb2 100644
> --- a/drivers/gpu/drm/drm_crtc_helper.c
> +++ b/drivers/gpu/drm/drm_crtc_helper.c
> @@ -927,10 +927,12 @@ int drm_helper_crtc_mode_set(struct drm_crtc *crtc,
> struct drm_display_mode *mod
>
> if (crtc->funcs->atomic_duplicate_state)
> crtc_state = crtc->funcs->atomic_duplicate_state(crtc);
> -   else if (crtc->state)
> +   else {
> +   if (!crtc->state)
> +   drm_atomic_helper_crtc_reset(crtc);
> +
> crtc_state = drm_atomic_helper_crtc_duplicate_state(crtc);
> -   else
> -   crtc_state = kzalloc(sizeof(*crtc_state), GFP_KERNEL);
> +   }
>
> if (!crtc_state)
> return -ENOMEM;
> diff --git a/drivers/gpu/drm/drm_plane_helper.c
> b/drivers/gpu/drm/drm_plane_helper.c
> index 2f0ed11024eb..b07a213f5655 100644
> --- a/drivers/gpu/drm/drm_plane_helper.c
> +++ b/drivers/gpu/drm/drm_plane_helper.c
> @@ -525,10 +525,12 @@ int drm_plane_helper_update(struct drm_plane *plane,
> struct drm_crtc *crtc,
>
> if (plane->funcs->atomic_duplicate_state)
> plane_state = plane->funcs->atomic_duplicate_state(plane);
> -   else if (plane->state)
> +   else {
> +   if (!plane->state)
> +   drm_atomic_helper_plane_reset(plane);
> +
> plane_state =
> drm_atomic_helper_plane_duplicate_state(plane);
> -   else
> -   plane_state = kzalloc(sizeof(*plane_state), GFP_KERNEL);
> +   }
> if (!plane_state)
> return -ENOMEM;
> plane_state->plane = plane;
> @@ -572,10 +574,12 @@ int drm_plane_helper_disable(struct drm_plane *plane)
>
> if (plane->funcs->atomic_duplicate_state)
> plane_state = plane->funcs->atomic_duplicate_state(plane);
> -   else if (plane->state)
> +   else {
> +   if (!plane->state)
> +   drm_atomic_helper_plane_reset(plane);
> +
> plane_state =
> drm_atomic_helper_plane_duplicate_state(plane);
> -   else
> -   plane_state = kzalloc(sizeof(*plane_state), GFP_KERNEL);
> +   }
> if (!plane_state)
> return -ENOMEM;
> plane_state->plane = plane;
> --
> 2.1.4
>
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
>



-- 
Best regards
Junwang Zhao
Microprocessor Research and Develop Center
Department of Computer Science 
Peking University
Beijing, 100871, PRC
-- next part --
An HTML attachment was scrubbed...
URL: 



[PATCH] drm/bochs: convert bochs driver to atomic mode-setting

2015-06-11 Thread John Hunter
On Thu, Jun 11, 2015 at 2:29 PM, Gerd Hoffmann  wrote:

> On Do, 2015-06-11 at 11:18 +0800, John Hunter wrote:
> > Hi Gerd,
> > Here is what I got:
> >
> >
> > [  813.137939] [drm:drm_pci_init]
> > [  813.142780] [drm:drm_get_pci_dev]
> > [  813.156986] [drm:drm_minor_register]
> > [  813.212679] [drm:drm_minor_register] new minor registered 64
> > [  813.213341] [drm:drm_minor_register]
> > [  813.215081] [drm:drm_minor_register]
> > [  813.235736] [drm:drm_minor_register] new minor registered 0
> > [  813.252701] [drm] Found bochs VGA, ID 0xb0c0.
> > [  813.254993] [drm] Framebuffer size 8192 kB @ 0xfe00, ioports @
> > 0x1ce.
> > [  813.271384] [TTM] Zone  kernel: Available graphics memory: 513150
> > kiB
> > [  813.272036] [TTM] Initializing pool allocator
> > [  813.279538] [TTM] Initializing DMA pool allocator
> > [  813.299800] [drm:drm_sysfs_connector_add] adding "Virtual-1" to
> > sysfs
> > [  813.303164] [drm:drm_sysfs_hotplug_event] generating hotplug event
> > [  813.313079] [drm] Initialized bochs-drm 1.0.0 20130925 for
> > :00:02.0 on minor 0
>
> Looks good.
>
> > If I remove the bochs-drm.ko from its place, then boot the virtual
> > machine, after it runs,
> > copy the bochs-drm.ko to its original place, depmod the module, and
> > modprobe
> > bochs-drm, it give the messages above. Seems like the bochs driver
> > works, but
> > if I reboot with the bochs-drm.ko, it goes to dark, and the messages
> > related to bochs
> > is same as above.
>
> Hmm, behavior should be the same no matter whenever it is loaded
> automatically at boot time or manually later on.
>
> You can blacklist the module in modprobe.conf if you want prevent it
> from autoloading btw.
>
> Thanks for the information


> > I guess the problem is because that I take no care of bochs_hw_setbase
> > after remove
> > the bochs_crtc_mode_set_base, but I am not sure.
>
> Possibly, programming the hardware needs to happen at some point ...
> Stick a printk in there to see whenever it is called or not.
>
> But remember you don't have a framebuffer console because fbcon is
> turned off.  So not having VTs is normal (and thats why you need the
> serial console ...)
>
> What happens if you start X?
>
> I think in the distro (debian 7) it runs X automatically


> > I will be appreciate if you can review the patch a bit and tell me
> > where the problem
> > might be, and I will dig more into that.
>
> Well, it's your gsoc project, not mine.

I guess I have asked a stupid question :) , sorry about that.
Anyway, I will try to figure it out.

>
>
cheers,
>   Gerd
>
>
>


-- 
Best regards
Junwang Zhao
Microprocessor Research and Develop Center
Department of Computer Science 
Peking University
Beijing, 100871, PRC
-- next part --
An HTML attachment was scrubbed...
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20150611/45584ca1/attachment-0001.html>


[PATCH] drm/bochs: convert bochs driver to atomic mode-setting

2015-06-11 Thread John Hunter
Hi Gerd,
Here is what I got:

[  813.137939] [drm:drm_pci_init]
[  813.142780] [drm:drm_get_pci_dev]
[  813.156986] [drm:drm_minor_register]
[  813.212679] [drm:drm_minor_register] new minor registered 64
[  813.213341] [drm:drm_minor_register]
[  813.215081] [drm:drm_minor_register]
[  813.235736] [drm:drm_minor_register] new minor registered 0
[  813.252701] [drm] Found bochs VGA, ID 0xb0c0.
[  813.254993] [drm] Framebuffer size 8192 kB @ 0xfe00, ioports @ 0x1ce.
[  813.271384] [TTM] Zone  kernel: Available graphics memory: 513150 kiB
[  813.272036] [TTM] Initializing pool allocator
[  813.279538] [TTM] Initializing DMA pool allocator
[  813.299800] [drm:drm_sysfs_connector_add] adding "Virtual-1" to sysfs
[  813.303164] [drm:drm_sysfs_hotplug_event] generating hotplug event
[  813.313079] [drm] Initialized bochs-drm 1.0.0 20130925 for :00:02.0
on minor 0

If I remove the bochs-drm.ko from its place, then boot the virtual machine,
after it runs,
copy the bochs-drm.ko to its original place, depmod the module, and
modprobe
bochs-drm, it give the messages above. Seems like the bochs driver works,
but
if I reboot with the bochs-drm.ko, it goes to dark, and the messages
related to bochs
is same as above.

I guess the problem is because that I take no care of bochs_hw_setbase
after remove
the bochs_crtc_mode_set_base, but I am not sure.

I will be appreciate if you can review the patch a bit and tell me where
the problem
might be, and I will dig more into that.

I really can't get any clue.

If my question is stupid, forgive me, I will try to catch up :)

Best Regards,
Zhao

On Wed, Jun 10, 2015 at 8:20 PM, Gerd Hoffmann  wrote:

> On Mi, 2015-06-10 at 19:39 +0800, John Hunter wrote:
> > Hi Gerd,
> > I have tried what you told me.
> > 1. Turn off fbdev support:
> > static bool enable_fbdev = false;
>
> Good.
>
> > 2. configure a serial console:
> > - add something like "console=ttyS0, 9600n8" to the grub menuentry
>
> Good.
>
> You can use 115200 as line speed to speedup the console a bit.
>
> > - add a start parameter to qemu when start the virtual machine
> > "-serial pty"
>
> '-serial stdio' might be more convenient.
>
> > saned disabled; edit /etc/default/saned
> > [ ok ] Starting network connection manager: NetworkManager.
> > [ ok ] Starting Common Unix Printing System: cupsd.
> >
> >
> > The serial console messages also stop here, no other output.
>
> Which guest is this?  On modern linux distros (anything systemd-based)
> you should automatically get a login prompt on the serial line in case
> it is configured as console.  Older systems need manual configuration
> for that.  Could also be the system simply hangs here.
>
> Try adding "ignore_loglevel" and "drm.debug=0x07" to the kernel command
> line.
>
> HTH,
>   Gerd
>
>
>
>


-- 
Best regards
Junwang Zhao
Microprocessor Research and Develop Center
Department of Computer Science 
Peking University
Beijing, 100871, PRC
-- next part --
An HTML attachment was scrubbed...
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20150611/5e9db4f1/attachment.html>


[PATCH] drm/bochs: convert bochs driver to atomic mode-setting

2015-06-10 Thread John Hunter
Hi Gerd,
I have tried what you told me.
1. Turn off fbdev support:
static bool enable_fbdev = *false*;
2. configure a serial console:
- add something like "*console=ttyS0, 9600n8*" to the grub menuentry
- add a start parameter to qemu when start the virtual machine "*-serial
pty*"
- got a redirected device like "*char device redirected to /dev/pts/2*"
- see the vritual machine's kernel messages in a host console by typing
"*cat /dev/pts/2*"

And stuck in dark but got the messages bellow:

saned disabled; edit /etc/default/saned
[ ok ] Starting network connection manager: NetworkManager.
[ ok ] Starting Common Unix Printing System: cupsd.

The serial console messages also stop here, no other output.

I just don't know if I did the right thing, if I did something wrong, I
would be appreaciate if
you show me.

Best Regards,
Zhao


On Wed, Jun 10, 2015 at 4:15 PM, John Hunter  wrote:

> Thanks for the information, I will try that : )
>
> On Wed, Jun 10, 2015 at 4:04 PM, Gerd Hoffmann  wrote:
>
>>   Hi,
>>
>> > As far as I know, the convertion got some problem, and after I
>> > add the bochs driver when I boot the qemu VM, it just can not
>> > start up, works fine if I delete bochs-drm.ko from it's directory.
>>
>> With fbdev enabled alot initialization happens with some important
>> console lock taken, which has the effect that you don't see any kernel
>> messages until it all succeeded.  If it doesn't succeed you are stuck in
>> the dark.  Guess this is what happened ...
>>
>> So, configure a serial console for your virtual machine.
>> Turn off fbdev support (bochs_drm has a module option for that).
>> That most likely gives you a clue where things blow up.
>>
>> Then get X11 running.
>> kmscon is a nice test too.
>> When all this works try turning fbdev back on.
>>
>> HTH,
>>   Gerd
>>
>>
>>
>
>
> --
> Best regards
> Junwang Zhao
> Microprocessor Research and Develop Center
> Department of Computer Science 
> Peking University
> Beijing, 100871, PRC
>



-- 
Best regards
Junwang Zhao
Microprocessor Research and Develop Center
Department of Computer Science 
Peking University
Beijing, 100871, PRC
-- next part --
An HTML attachment was scrubbed...
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20150610/b9c77032/attachment.html>


[PATCH] drm/bochs: convert bochs driver to atomic mode-setting

2015-06-10 Thread John Hunter
Thanks for the information, I will try that : )

On Wed, Jun 10, 2015 at 4:04 PM, Gerd Hoffmann  wrote:

>   Hi,
>
> > As far as I know, the convertion got some problem, and after I
> > add the bochs driver when I boot the qemu VM, it just can not
> > start up, works fine if I delete bochs-drm.ko from it's directory.
>
> With fbdev enabled alot initialization happens with some important
> console lock taken, which has the effect that you don't see any kernel
> messages until it all succeeded.  If it doesn't succeed you are stuck in
> the dark.  Guess this is what happened ...
>
> So, configure a serial console for your virtual machine.
> Turn off fbdev support (bochs_drm has a module option for that).
> That most likely gives you a clue where things blow up.
>
> Then get X11 running.
> kmscon is a nice test too.
> When all this works try turning fbdev back on.
>
> HTH,
>   Gerd
>
>
>


-- 
Best regards
Junwang Zhao
Microprocessor Research and Develop Center
Department of Computer Science 
Peking University
Beijing, 100871, PRC
-- next part --
An HTML attachment was scrubbed...
URL: 



[PATCH] drm/bochs: convert bochs driver to atomic mode-setting

2015-06-10 Thread John Hunter
From: root 

convert the bochs driver to atomic mode-setting, referencing the
patch serias of drm/exynos sent by Gustavo Padovan

Signed-off-by: Zhao Junwang 

---
Hi all, I am a GSoCer of this year, and my project is to convert
bochs driver and cirrus driver to atomic mode-setting.

I converted the bochs driver to atomic mode-setting by referencing
the patch serias of drm/exynos sent by Gustavo Padovan.

As far as I know, the convertion got some problem, and after I
add the bochs driver when I boot the qemu VM, it just can not
start up, works fine if I delete bochs-drm.ko from it's directory.

I am stuck here, I hope some one could review this patch and give
some tips, so I can go on with by project.
---
 drivers/gpu/drm/bochs/bochs.h |2 +
 drivers/gpu/drm/bochs/bochs_drv.c |2 +-
 drivers/gpu/drm/bochs/bochs_kms.c |  147 ++---
 drivers/gpu/drm/bochs/bochs_mm.c  |   10 +++
 4 files changed, 68 insertions(+), 93 deletions(-)

diff --git a/drivers/gpu/drm/bochs/bochs.h b/drivers/gpu/drm/bochs/bochs.h
index 71f2687..3e16f63 100644
--- a/drivers/gpu/drm/bochs/bochs.h
+++ b/drivers/gpu/drm/bochs/bochs.h
@@ -5,6 +5,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 

 #include 
diff --git a/drivers/gpu/drm/bochs/bochs_drv.c 
b/drivers/gpu/drm/bochs/bochs_drv.c
index 98837bd..fc31643 100644
--- a/drivers/gpu/drm/bochs/bochs_drv.c
+++ b/drivers/gpu/drm/bochs/bochs_drv.c
@@ -79,7 +79,7 @@ static const struct file_operations bochs_fops = {
 };

 static struct drm_driver bochs_driver = {
-   .driver_features= DRIVER_GEM | DRIVER_MODESET,
+   .driver_features= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
.load   = bochs_load,
.unload = bochs_unload,
.set_busid  = drm_pci_set_busid,
diff --git a/drivers/gpu/drm/bochs/bochs_kms.c 
b/drivers/gpu/drm/bochs/bochs_kms.c
index 26bcd03..1d04615 100644
--- a/drivers/gpu/drm/bochs/bochs_kms.c
+++ b/drivers/gpu/drm/bochs/bochs_kms.c
@@ -18,16 +18,24 @@ MODULE_PARM_DESC(defy, "default y resolution");

 /* -- */

-static void bochs_crtc_dpms(struct drm_crtc *crtc, int mode)
+static void bochs_crtc_enable(struct drm_crtc *crtc)
 {
-   switch (mode) {
-   case DRM_MODE_DPMS_ON:
-   case DRM_MODE_DPMS_STANDBY:
-   case DRM_MODE_DPMS_SUSPEND:
-   case DRM_MODE_DPMS_OFF:
-   default:
+   if (crtc->enabled)
return;
-   }
+
+   crtc->enabled = true;
+
+   drm_crtc_vblank_on(crtc);
+}
+
+static void bochs_crtc_disable(struct drm_crtc *crtc)
+{
+   if (!crtc->enabled)
+   return;
+
+   drm_crtc_vblank_off(crtc);
+
+   crtc->enabled = false;
 }

 static bool bochs_crtc_mode_fixup(struct drm_crtc *crtc,
@@ -37,109 +45,66 @@ static bool bochs_crtc_mode_fixup(struct drm_crtc *crtc,
return true;
 }

-static int bochs_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,
-   struct drm_framebuffer *old_fb)
+static void bochs_crtc_mode_set_nofb(struct drm_crtc *crtc)
 {
struct bochs_device *bochs =
container_of(crtc, struct bochs_device, crtc);
-   struct bochs_framebuffer *bochs_fb;
-   struct bochs_bo *bo;
-   u64 gpu_addr = 0;
-   int ret;
-
-   if (old_fb) {
-   bochs_fb = to_bochs_framebuffer(old_fb);
-   bo = gem_to_bochs_bo(bochs_fb->obj);
-   ret = ttm_bo_reserve(>bo, true, false, false, NULL);
-   if (ret) {
-   DRM_ERROR("failed to reserve old_fb bo\n");
-   } else {
-   bochs_bo_unpin(bo);
-   ttm_bo_unreserve(>bo);
-   }
-   }
-
-   if (WARN_ON(crtc->primary->fb == NULL))
-   return -EINVAL;

-   bochs_fb = to_bochs_framebuffer(crtc->primary->fb);
-   bo = gem_to_bochs_bo(bochs_fb->obj);
-   ret = ttm_bo_reserve(>bo, true, false, false, NULL);
-   if (ret)
-   return ret;
-
-   ret = bochs_bo_pin(bo, TTM_PL_FLAG_VRAM, _addr);
-   if (ret) {
-   ttm_bo_unreserve(>bo);
-   return ret;
-   }
+   if (WARN_ON(!crtc->state))
+   return;

-   ttm_bo_unreserve(>bo);
-   bochs_hw_setbase(bochs, x, y, gpu_addr);
-   return 0;
+   /* set mode only (no scanout buffer attached), don't need set base */
+   bochs_hw_setmode(bochs, >state->adjusted_mode);
 }

-static int bochs_crtc_mode_set(struct drm_crtc *crtc,
-  struct drm_display_mode *mode,
-  struct drm_display_mode *adjusted_mode,
-  int x, int y, struct drm_framebuffer *old_fb)
+static int bochs_crtc_atomic_check(struct drm_crtc *crtc,
+   struct drm_crtc_state *state)
 {
-   

[Intel-gfx] [PATCH -next] drm/i915/audio: remove duplicated include from intel_audio.c

2015-04-24 Thread John Hunter
ok, let's keep it the the original way.

On Fri, Apr 24, 2015 at 12:09 AM, Daniel Vetter  wrote:

> On Wed, Apr 22, 2015 at 10:50:55AM +0800, John Hunter wrote:
> > Sure, but I need Daniel to admit that, because maybe include the two
> header
> > file make it easier to understand.
> > And after checked other files in drm/i915, I found that a lot other file
> do
> > the
> > same thing(include both header file). So I will just wait Daniel to wait
> up
> > and
> > give me the order :-)
>
> drm/i915 headers are a bit a chaos anyway, so I'm not sure how useful that
> would be really. And generally the trend in linux (and drm) is to have
> split-up headers, so moving everyone to just include intel_drv.h would be
> the "wrong" direction.
>
> tbh I just don't have an opinion really ;-)
> -Daniel
>
> >
> > On Wed, Apr 22, 2015 at 10:35 AM, yongjun_wei at trendmicro.com.cn <
> > yongjun_wei at trendmicro.com.cn> wrote:
> >
> > >  Hi John,
> > >
> > >
> > >
> > > Feel free to submit a new patch.
> > >
> > >
> > >
> > > Regards,
> > >
> > > Yongjun Wei
> > >
> > >
> > >
> > > *From:* John Hunter [mailto:zhjwpku at gmail.com]
> > > *Sent:* 2015年4月22日 10:30
> > > *To:* weiyj_lk at 163.com; Daniel Vetter; Jani Nikula; David Airlie;
> Yongjun
> > > Wei (RD-CN); intel-gfx at lists.freedesktop.org;
> > > dri-devel at lists.freedesktop.org; open list
> > > *Subject:* Re: [Intel-gfx] [PATCH -next] drm/i915/audio: remove
> > > duplicated include from intel_audio.c
> > >
> > >
> > >
> > > Hi,
> > >
> > >
> > >
> > > I think maybe we should remove both of the two lines:
> > >
> > > #include "intel_drv.h"
> > >
> > > #include "i915_drv.h"
> > >
> > > Because we have* two* "intel_drv.h" and *one* "i915_drv.h", and
> > >
> > > "i915_drv.h" has already been included in the "intel_drv.h".
> > >
> > >
> > >
> > > I not sure whether i am right. If you need me to do the patch,
> > >
> > > let me know.
> > >
> > >
> > >
> > >
> > >
> > > On Thu, Apr 16, 2015 at 10:30 PM, Daniel Vetter 
> wrote:
> > >
> > > On Thu, Apr 16, 2015 at 09:11:08PM +0800, weiyj_lk at 163.com wrote:
> > > > From: Wei Yongjun 
> > > >
> > > > Remove duplicated include.
> > > >
> > > > Signed-off-by: Wei Yongjun 
> > >
> > > Queued for -next, thanks for the patch.
> > > -Daniel
> > >
> > > > ---
> > > >  drivers/gpu/drm/i915/intel_audio.c | 1 -
> > > >  1 file changed, 1 deletion(-)
> > > >
> > > > diff --git a/drivers/gpu/drm/i915/intel_audio.c
> > > b/drivers/gpu/drm/i915/intel_audio.c
> > > > index 2396cc7..d00d488 100644
> > > > --- a/drivers/gpu/drm/i915/intel_audio.c
> > > > +++ b/drivers/gpu/drm/i915/intel_audio.c
> > > > @@ -28,7 +28,6 @@
> > > >
> > > >  #include 
> > > >  #include 
> > > > -#include "intel_drv.h"
> > > >  #include "i915_drv.h"
> > > >
> > > >  /**
> > > >
> > > > ___
> > > > Intel-gfx mailing list
> > > > Intel-gfx at lists.freedesktop.org
> > > > http://lists.freedesktop.org/mailman/listinfo/intel-gfx
> > >
> > > --
> > > Daniel Vetter
> > > Software Engineer, Intel Corporation
> > > http://blog.ffwll.ch
> > >
> > > ___
> > > dri-devel mailing list
> > > dri-devel at lists.freedesktop.org
> > > http://lists.freedesktop.org/mailman/listinfo/dri-devel
> > >
> > >
> > >
> > >
> > >
> > > --
> > >
> > > Best regards
> > >
> > > Junwang Zhao
> > >
> > > Microprocessor Research and Develop Center
> > >
> > > Department of Computer Science 
> > >
> > > Peking University
> > >
> > > Beijing, 100871, PRC
> > >
> > > ===
> > >
> > > This message has been analyzed by Deep Discovery Email Inspector.
> > >
> > >
> > >
> > > TREND MICRO EMAIL NOTICE
> > > The information contained in this email and any attachments is
> confidential
> > > and may be subject to copyright or other intellectual property
> protection.
> > > If you are not the intended recipient, you are not authorized to use or
> > > disclose this information, and we request that you notify us by reply
> mail or
> > > telephone and delete the original message from your mail system.
> > >
> > >
> >
> >
> > --
> > Best regards
> > Junwang Zhao
> > Microprocessor Research and Develop Center
> > Department of Computer Science 
> > Peking University
> > Beijing, 100871, PRC
>
> > ___
> > dri-devel mailing list
> > dri-devel at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/dri-devel
>
>
> --
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch
>



-- 
Best regards
Junwang Zhao
Microprocessor Research and Develop Center
Department of Computer Science 
Peking University
Beijing, 100871, PRC
-- next part --
An HTML attachment was scrubbed...
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20150424/4fbb8764/attachment.html>


[Intel-gfx] [PATCH -next] drm/i915/audio: remove duplicated include from intel_audio.c

2015-04-22 Thread John Hunter
Sure, but I need Daniel to admit that, because maybe include the two header
file make it easier to understand.
And after checked other files in drm/i915, I found that a lot other file do
the
same thing(include both header file). So I will just wait Daniel to wait up
and
give me the order :-)

On Wed, Apr 22, 2015 at 10:35 AM, yongjun_wei at trendmicro.com.cn <
yongjun_wei at trendmicro.com.cn> wrote:

>  Hi John,
>
>
>
> Feel free to submit a new patch.
>
>
>
> Regards,
>
> Yongjun Wei
>
>
>
> *From:* John Hunter [mailto:zhjwpku at gmail.com]
> *Sent:* 2015年4月22日 10:30
> *To:* weiyj_lk at 163.com; Daniel Vetter; Jani Nikula; David Airlie; Yongjun
> Wei (RD-CN); intel-gfx at lists.freedesktop.org;
> dri-devel at lists.freedesktop.org; open list
> *Subject:* Re: [Intel-gfx] [PATCH -next] drm/i915/audio: remove
> duplicated include from intel_audio.c
>
>
>
> Hi,
>
>
>
> I think maybe we should remove both of the two lines:
>
> #include "intel_drv.h"
>
> #include "i915_drv.h"
>
> Because we have* two* "intel_drv.h" and *one* "i915_drv.h", and
>
> "i915_drv.h" has already been included in the "intel_drv.h".
>
>
>
> I not sure whether i am right. If you need me to do the patch,
>
> let me know.
>
>
>
>
>
> On Thu, Apr 16, 2015 at 10:30 PM, Daniel Vetter  wrote:
>
> On Thu, Apr 16, 2015 at 09:11:08PM +0800, weiyj_lk at 163.com wrote:
> > From: Wei Yongjun 
> >
> > Remove duplicated include.
> >
> > Signed-off-by: Wei Yongjun 
>
> Queued for -next, thanks for the patch.
> -Daniel
>
> > ---
> >  drivers/gpu/drm/i915/intel_audio.c | 1 -
> >  1 file changed, 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/i915/intel_audio.c
> b/drivers/gpu/drm/i915/intel_audio.c
> > index 2396cc7..d00d488 100644
> > --- a/drivers/gpu/drm/i915/intel_audio.c
> > +++ b/drivers/gpu/drm/i915/intel_audio.c
> > @@ -28,7 +28,6 @@
> >
> >  #include 
> >  #include 
> > -#include "intel_drv.h"
> >  #include "i915_drv.h"
> >
> >  /**
> >
> > ___
> > Intel-gfx mailing list
> > Intel-gfx at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/intel-gfx
>
> --
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch
>
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
>
>
>
>
>
> --
>
> Best regards
>
> Junwang Zhao
>
> Microprocessor Research and Develop Center
>
> Department of Computer Science 
>
> Peking University
>
> Beijing, 100871, PRC
>
> ===
>
> This message has been analyzed by Deep Discovery Email Inspector.
>
>
>
> TREND MICRO EMAIL NOTICE
> The information contained in this email and any attachments is confidential
> and may be subject to copyright or other intellectual property protection.
> If you are not the intended recipient, you are not authorized to use or
> disclose this information, and we request that you notify us by reply mail or
> telephone and delete the original message from your mail system.
>
>


-- 
Best regards
Junwang Zhao
Microprocessor Research and Develop Center
Department of Computer Science 
Peking University
Beijing, 100871, PRC
-- next part --
An HTML attachment was scrubbed...
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20150422/8fd9604a/attachment.html>


[Intel-gfx] [PATCH -next] drm/i915/audio: remove duplicated include from intel_audio.c

2015-04-22 Thread John Hunter
Hi,

I think maybe we should remove both of the two lines:
#include "intel_drv.h"
#include "i915_drv.h"
Because we have* two* "intel_drv.h" and *one* "i915_drv.h", and
"i915_drv.h" has already been included in the "intel_drv.h".

I not sure whether i am right. If you need me to do the patch,
let me know.


On Thu, Apr 16, 2015 at 10:30 PM, Daniel Vetter  wrote:

> On Thu, Apr 16, 2015 at 09:11:08PM +0800, weiyj_lk at 163.com wrote:
> > From: Wei Yongjun 
> >
> > Remove duplicated include.
> >
> > Signed-off-by: Wei Yongjun 
>
> Queued for -next, thanks for the patch.
> -Daniel
>
> > ---
> >  drivers/gpu/drm/i915/intel_audio.c | 1 -
> >  1 file changed, 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/i915/intel_audio.c
> b/drivers/gpu/drm/i915/intel_audio.c
> > index 2396cc7..d00d488 100644
> > --- a/drivers/gpu/drm/i915/intel_audio.c
> > +++ b/drivers/gpu/drm/i915/intel_audio.c
> > @@ -28,7 +28,6 @@
> >
> >  #include 
> >  #include 
> > -#include "intel_drv.h"
> >  #include "i915_drv.h"
> >
> >  /**
> >
> > ___
> > Intel-gfx mailing list
> > Intel-gfx at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/intel-gfx
>
> --
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
>



-- 
Best regards
Junwang Zhao
Microprocessor Research and Develop Center
Department of Computer Science 
Peking University
Beijing, 100871, PRC
-- next part --
An HTML attachment was scrubbed...
URL: 



[PATCH] drm: fix trivial typo mistake

2015-04-14 Thread John Hunter
Signed-off-by: John Hunter 
---
 include/drm/drm_crtc.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 2e80ad1..8ad8507 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -974,7 +974,7 @@ struct drm_mode_set {
  * struct drm_mode_config_funcs - basic driver provided mode setting functions
  * @fb_create: create a new framebuffer object
  * @output_poll_changed: function to handle output configuration changes
- * @atomic_check: check whether a give atomic state update is possible
+ * @atomic_check: check whether a given atomic state update is possible
  * @atomic_commit: commit an atomic state update previously verified with
  * atomic_check()
  *
-- 
1.9.1




[PATCH] drm: Fix some typos

2015-04-07 Thread John Hunter
Signed-off-by: John Hunter 
---
 drivers/gpu/drm/drm_atomic.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index 57efdbe..0537f32 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -780,7 +780,7 @@ drm_atomic_set_crtc_for_plane(struct drm_plane_state 
*plane_state,
 EXPORT_SYMBOL(drm_atomic_set_crtc_for_plane);

 /**
- * drm_atomic_set_fb_for_plane - set crtc for plane
+ * drm_atomic_set_fb_for_plane - set framebuffer for plane
  * @plane_state: atomic state object for the plane
  * @fb: fb to use for the plane
  *
@@ -933,7 +933,7 @@ EXPORT_SYMBOL(drm_atomic_connectors_for_crtc);
  *
  * This function should be used by legacy entry points which don't understand
  * -EDEADLK semantics. For simplicity this one will grab all modeset locks 
after
- *  the slowpath completed.
+ * the slowpath completed.
  */
 void drm_atomic_legacy_backoff(struct drm_atomic_state *state)
 {
-- 
1.9.1




Is CIRRUS a suitable driver to convert to atomic mode-setting

2015-04-07 Thread John Hunter
Hi Gerd,
Thanks for the suggestion.
I will try my best :)

On Tue, Apr 7, 2015 at 4:55 PM, Gerd Hoffmann  wrote:

>   Hi,
>
> > I think at least I should give it a try. If it is really impossible to
> > convert, then
> > we should talk about whether we should deprecate it in the future.
>
> Feel free to try.  I don't mind being proven wrong ;)
>
> > And I hope to treat cirrus as an test filed, it's a easier driver, so
> > I can get into
> > the drm kernel hacking quickly.
>
> I'd suggest to start with bochs, I'm sure it is easier that cirrus.
>
> cheers,
>   Gerd
>
>
>
>


-- 
Best regards
Junwang Zhao
Microprocessor Research and Develop Center
Department of Computer Science 
Peking University
Beijing, 100871, PRC
-- next part --
An HTML attachment was scrubbed...
URL: 



Is CIRRUS a suitable driver to convert to atomic mode-setting

2015-04-07 Thread John Hunter
On Tue, Apr 7, 2015 at 2:56 PM, Gerd Hoffmann  wrote:

> On Do, 2015-04-02 at 09:57 +0800, John Hunter wrote:
> > Hi Daniel,
> > Sorry to disturb you, I realized you are a busy man of the community.
> > So I did some work before I email you.
> >
> >
> > I submit my proposal as you suggest, convert the two virtual driver
> > (CIRRUS
> > and BOCHS, if I remember it right) to atomic mode-setting.
> >
> >
> > After talked with Martin Peres(the administrator of xorg on gsoc) and
> > Gerd Hoffmann (the author of VirtIO gpu driver), we got this question,
> > is CIRRUS suitable to convert, as qemu using cirrus considered
> > harmful.
>
> Short background summary on the later for everybody involved:
>
> cirrus emulates hardware from the 90ies which simply isn't up to todays
> needs.  The two major issues:
>
>  * It has very limited video memory.  The cirrus driver does swap
>framebuffers in and out of video memory because of that.  I suspect
>converting the driver to atomic modesetting will be either impossible
>or at least pretty difficult because of that.  The limited video
>memory also limits the available resolutions, cirrus can't do FullHD
>for example.
>

I think at least I should give it a try. If it is really impossible to
convert, then
we should talk about whether we should deprecate it in the future.
And I hope to treat cirrus as an test filed, it's a easier driver, so I can
get into
the drm kernel hacking quickly.

 * cirrus can run 1024x768 only at 24bpp (not 32bpp).  Which is rather
>unusual these days and cirrus has display issues in xorg because it
>takes code paths which are not really maintained & tested any more.
>
> cirrus isn't the default vga any more in qemu version 2.2 & newer
> because of these problems.
>
> cheers,
>   Gerd
>
>
>
>


-- 
Best regards
Junwang Zhao
Microprocessor Research and Develop Center
Department of Computer Science 
Peking University
Beijing, 100871, PRC
-- next part --
An HTML attachment was scrubbed...
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20150407/5f4015c3/attachment.html>


Is CIRRUS a suitable driver to convert to atomic mode-setting

2015-04-02 Thread John Hunter
Hi Daniel,
Sorry to disturb you, I realized you are a busy man of the community.
So I did some work before I email you.

I submit my proposal as you suggest, convert the two virtual driver (CIRRUS
and BOCHS, if I remember it right) to atomic mode-setting.

After talked with Martin Peres(the administrator of xorg on gsoc) and
Gerd Hoffmann (the author of VirtIO gpu driver), we got this question,
is CIRRUS suitable to convert, as qemu using cirrus considered harmful.


-- 
Best regards
Junwang Zhao
Microprocessor Research and Develop Center
Department of Computer Science 
Peking University
Beijing, 100871, PRC
-- next part --
An HTML attachment was scrubbed...
URL: 



[PATCH v2 1/4] break kconfig dependency loop

2015-04-01 Thread John Hunter
Hi Gerd,
I've read the patches about the virtio-gpu, it's a nice design.
As far as I know, there are two other drivers used by qemu, CIRRUS and
BOCHS.
I have a question about the relationship of these three drivers, is that
the virtio-gpu
designed to replace the other two drivers? I mean are the CIRRUS and BOCHS
going to be deprecated in the future?

Would you please kindly explain this a little bit?

Actually, this is a problem by *Martin Peres* who is the GSoC xorg
administor.
My proposal is "Convert the BOCHS and CIRRUS drivers to atomic
mode-setting".
Martin wonder if the two drivers are going to be deprecated, there is no
need for
me to do the job.

Best regards,
John

On Wed, Apr 1, 2015 at 9:15 PM, Gerd Hoffmann  wrote:

> After adding virtio-gpu I get this funky kconfig dependency loop.
>
> scripts/kconfig/conf --oldconfig Kconfig
> drivers/video/fbdev/Kconfig:5:error: recursive dependency detected!
> drivers/video/fbdev/Kconfig:5:  symbol FB is selected by DRM_KMS_FB_HELPER
> drivers/gpu/drm/Kconfig:34: symbol DRM_KMS_FB_HELPER is selected by
> DRM_VIRTIO_GPU
> drivers/gpu/drm/virtio/Kconfig:1:   symbol DRM_VIRTIO_GPU depends on
> VIRTIO
> drivers/virtio/Kconfig:1:   symbol VIRTIO is selected by REMOTEPROC
> drivers/remoteproc/Kconfig:4:   symbol REMOTEPROC is selected by
> OMAP_REMOTEPROC
> drivers/remoteproc/Kconfig:12:  symbol OMAP_REMOTEPROC depends on
> OMAP_IOMMU
> drivers/iommu/Kconfig:141:  symbol OMAP_IOMMU is selected by
> VIDEO_OMAP3
> drivers/media/platform/Kconfig:96:  symbol VIDEO_OMAP3 depends on
> VIDEO_V4L2
> drivers/media/v4l2-core/Kconfig:6:  symbol VIDEO_V4L2 depends on I2C
> drivers/i2c/Kconfig:7:  symbol I2C is selected by FB_DDC
> drivers/video/fbdev/Kconfig:59: symbol FB_DDC is selected by
> FB_CYBER2000_DDC
> drivers/video/fbdev/Kconfig:374:symbol FB_CYBER2000_DDC depends on
> FB_CYBER2000
> drivers/video/fbdev/Kconfig:362:symbol FB_CYBER2000 depends on FB
>
> Making VIDEO_OMAP3 depend on OMAP_IOMMU instead of selecting it breaks the
> loop, which looks like the best way to handle it to me.  I'm open to better
> suggestions though.
>
> Signed-off-by: Gerd Hoffmann 
> ---
>  drivers/media/platform/Kconfig | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/media/platform/Kconfig
> b/drivers/media/platform/Kconfig
> index d9b872b..fc21734 100644
> --- a/drivers/media/platform/Kconfig
> +++ b/drivers/media/platform/Kconfig
> @@ -87,8 +87,8 @@ config VIDEO_OMAP3
> tristate "OMAP 3 Camera support"
> depends on VIDEO_V4L2 && I2C && VIDEO_V4L2_SUBDEV_API && ARCH_OMAP3
> depends on HAS_DMA
> +   depends on OMAP_IOMMU
> select ARM_DMA_USE_IOMMU
> -   select OMAP_IOMMU
> select VIDEOBUF2_DMA_CONTIG
> ---help---
>   Driver for an OMAP 3 camera controller.
> --
> 1.8.3.1
>
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
>



-- 
Best regards
Junwang Zhao
Microprocessor Research and Develop Center
Department of Computer Science 
Peking University
Beijing, 100871, PRC
-- next part --
An HTML attachment was scrubbed...
URL: 



My GSoC proposal needs help :-)

2015-03-23 Thread John Hunter
Hi Daniel, all

I spent the last days on my GSoC 2015 proposal, I've submited it to the
google-melange site. Now I post it here for you to review, hope you can
spare some time to give it a look and give me some advices.
Any comments and criticism is welcomed.

Convert the BOCHS and CIRRUS drivers to atomic mode-settingZhao Junwang

*Organization:* X.Org Foundation

*Abstract:* Atomic mode-setting has been discussed and designed for
literally years, now it's finally there, it is not only necessary but
allows a bunch of nice and long overdue cleanup and unification. There are
a lot ongoing atomic mode-setting conversions and some already committed to
drm-next ones, while there still are some subsystems haven't started the
work, as far as I know, radeon, udl, bochs and cirrus are some optional
drivers. I will take DRM_BOCHS and DRM_CIRRUS_QEMU as my converting goals.
*Introduction to the Project*

This project aims to convert two existing KMS drivers to atomic
mode-setting, DRM_BOCHS and DRM_CIRRUS_QEMU.
BOCHS stands for standard VGA card with Bochs VBE extensions, we can
emulate it in qemu by adding the option '-vga std'. While CIRRUS is the
default Video card that QEMU emulated.
For these two drivers used by KVM/QEMU, they are still in the Renaissace
era of KMS, something not perfect:

   - mode sets fail too late, if the mode-setting fails, there's no way to
   rollback
   - KMS does not guarantee that a configuration is applied in totality for
   the next frame
   - no VBLANK-synchronized page-flips for planes
   - not perfect frames

As we all know the weaknesses in the legacy KMS drivers now, we should
overcome them by convert the drivers into Atomic Mode-Setting. The Atomic
Mode-Setting

   - allows an output configuration to be validated before it is applied:
   - no hardware is touched before the driver acknowleges that the
  configuration is valid and can be applied
  - no need for rollback
  - allows atomic updates of an output configuration:
   - multiple planes updated at the same time
  - we got perfect frames show at the same time
  - allows for unification and simplification of drivers
   - legacy code can be removed from drivers
  - much of the handling moves into helpers (core DRM)

--

*Project Goals*
The project shall complete two legacy KMS drivers conversion individually:

   1. convert DRM_BOCHS driver into Atomic Mode-Setting driver
   2. convert DRM_CIRRUS_QEMU driver into Atomic Mode-Setting driver

Since Daniel did most of the Transtional and atomic helpers work, so the
conversion is surprisingly painless.
--
*Quantifiable Results for the DRI Community*

   - Make it a more complete ecosystem for the atomic mode-setting
   - Use unified helpers will make it more concise for the subsystem, less
   code

--
*Project Details*

Since radeon support about 18 years of asics and 8 generations of display
hardwares, the conversion will be a huge amout of work and there is a huge
potential regressions, so I choose two drivers used by kvm/qeum, which are
a lot simpler than mordern GPUs.
The following specified what needs to be done to support atomic modeset
updates using Daniel's new helper libraries.

*Phase 1 - Reworking the Driver Backend Functions for Planes*
There are two big mismatches between the new atomic semantics and the
legacy ioctl interfaces:
1) The primary plane is no longer tied to CRTC.
2) Atomic updates of multiple planes isn't supported at all.
Both issuse are addressed by adding new driver backend callbacks. So we
should implement legacy entry points in term of new atomic callbacks.
The first step is to rework the ->disable/update_plane hooks using the
transitional helper implementations drm_plane_helper_update/disable. The
following new driver callbacks are needed:

   - *CRTCs*
  - ->atomic_check()  - validate state
  - ->atomic_begin()  - prepare for updates
  - ->atomic_flush()   - apply updates atomically
  - ->atomic_set_nofb- apply CRTC timings, this callback must be
  implement
  - *planes*
  - ->prepare_fb()  - setup the framebuffers, e.g. pin backing
  storage into memory and setup any needed hardware resources
  - ->cleanup_fb()  - e.g. unpi backing storage
  - ->atomic_check()  - validate state
  - ->atomic_update() - per-plane update, like setting up the new
  viewport or the new base address of the framebuffer for each plane
  - ->atomic_disable() - disable plane

The provided helpers functions drm_helper_crtc_mode_set and
drm_helper_crtc_mode_set_base then implement the callbacks required by the
CRTC helpers in terms of new ->mode_set_nofb callback and the the above
newly implmented plane helper callbacks.
*Phase 2 - Wire up the Atomic State Object Scaffolding*
The goal of this phase is to get all the state object handing needed for
atomic updates 

[PATCH 2/3] drm: replace the 'for' condition with outside defined variable

2015-03-17 Thread John Hunter
Got it!

Cheers,
John

On Tue, Mar 17, 2015 at 5:24 PM, Daniel Vetter  wrote:

> On Tue, Mar 17, 2015 at 04:48:23PM +0800, John Hunter wrote:
> > Hi Daniel,
> >
> > On Tue, Mar 17, 2015 at 4:40 PM, Daniel Vetter  wrote:
> >
> > > On Tue, Mar 17, 2015 at 03:30:27PM +0800, John Hunter wrote:
> > > > use outdise defined variable can reduce the recaculate of the
> > > > count of planes, crtcs and connectors.
> > > >
> > > > Signed-off-by: John Hunter 
> > >
> > > Hm, what's the benefit you see for this change? The lines aren't too
> long
> > > yet and we don't reuse the expression, so imo code readability isn't
> > > improved.
> > >
> > I change this just reference some other functions in the same file.
> > like,
> >  drm_atomic_helper_check_planes
> >  wait_for_fences
> >  ...
> > I really think we should keep the same coding style in the same file.
> > If I am wrong with that, just ignore this patch :-)
>
> Indeed that's a bit inconsistent. But in cases like these where neither
> approach is really better I usually go with "don't change anything". Btw
> for the next patch the above explanation should be in the commit message.
> The important part isn't really explaining what you change (the code
> should be readable enough to make that clear), but _why_ you change
> something.
> -Daniel
>
> >
> > > -Daniel
> > > > ---
> > > >  drivers/gpu/drm/drm_atomic_helper.c | 9 ++---
> > > >  1 file changed, 6 insertions(+), 3 deletions(-)
> > > >
> > > > diff --git a/drivers/gpu/drm/drm_atomic_helper.c
> > > b/drivers/gpu/drm/drm_atomic_helper.c
> > > > index 39369ee..20376e6 100644
> > > > --- a/drivers/gpu/drm/drm_atomic_helper.c
> > > > +++ b/drivers/gpu/drm/drm_atomic_helper.c
> > > > @@ -1301,8 +1301,11 @@ void drm_atomic_helper_swap_state(struct
> > > drm_device *dev,
> > > > struct drm_atomic_state *state)
> > > >  {
> > > >   int i;
> > > > + int nconnectors = dev->mode_config.num_connector;
> > > > + int ncrtcs = dev->mode_config.num_crtc;
> > > > + int nplanes = dev->mode_config.num_total_plane;
> > > >
> > > > - for (i = 0; i < dev->mode_config.num_connector; i++) {
> > > > + for (i = 0; i < nconnectors; i++) {
> > > >   struct drm_connector *connector = state->connectors[i];
> > > >
> > > >   if (!connector)
> > > > @@ -1313,7 +1316,7 @@ void drm_atomic_helper_swap_state(struct
> > > drm_device *dev,
> > > >   connector->state->state = NULL;
> > > >   }
> > > >
> > > > - for (i = 0; i < dev->mode_config.num_crtc; i++) {
> > > > + for (i = 0; i < ncrtcs; i++) {
> > > >   struct drm_crtc *crtc = state->crtcs[i];
> > > >
> > > >   if (!crtc)
> > > > @@ -1324,7 +1327,7 @@ void drm_atomic_helper_swap_state(struct
> > > drm_device *dev,
> > > >   crtc->state->state = NULL;
> > > >   }
> > > >
> > > > - for (i = 0; i < dev->mode_config.num_total_plane; i++) {
> > > > + for (i = 0; i < nplanes; i++) {
> > > >   struct drm_plane *plane = state->planes[i];
> > > >
> > > >   if (!plane)
> > > > --
> > > > 1.9.1
> > > >
> > > >
> > > > ___
> > > > dri-devel mailing list
> > > > dri-devel at lists.freedesktop.org
> > > > http://lists.freedesktop.org/mailman/listinfo/dri-devel
> > >
> > > --
> > > Daniel Vetter
> > > Software Engineer, Intel Corporation
> > > http://blog.ffwll.ch
> > > ___
> > > dri-devel mailing list
> > > dri-devel at lists.freedesktop.org
> > > http://lists.freedesktop.org/mailman/listinfo/dri-devel
> > >
> >
> >
> >
> > --
> > Best regards
> > Junwang Zhao
> > Microprocessor Research and Develop Center
> > Department of Computer Science 
> > Peking University
> > Beijing, 100871, PRC
>
> --
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch
>



-- 
Best regards
Junwang Zhao
Microprocessor Research and Develop Center
Department of Computer Science 
Peking University
Beijing, 100871, PRC
-- next part --
An HTML attachment was scrubbed...
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20150317/e7f14e31/attachment.html>


Why no geode subsystem contained in drm

2015-03-17 Thread John Hunter
Thank you, Christian

Cheers,
John

On Tue, Mar 17, 2015 at 4:43 PM, Christian Gmeiner <
christian.gmeiner at gmail.com> wrote:

> Hi John
>
> > I noticed that there is no geode subsystem in the drm directory.
> > I have a system using the geode LX framebuffer and
> > xserver-xorg-video-geode. I am wondering if we can add the drm
> > part of geode lx to let it support the dri?
> >
>
> The geode thing is nearly EOL and is quite old to do some serious work.
> But you
> can always do everything you want in your spare time. I think there maybe
> some
> guys and girls out there which would love some thing like this :)
>
> > How about VIVANTE then?
> >
>
> wip -
> https://github.com/austriancoder/linux/tree/master/drivers/staging/etnaviv
>
> greets
> --
> Christian Gmeiner, MSc
>
> https://soundcloud.com/christian-gmeiner
>



-- 
Best regards
Junwang Zhao
Microprocessor Research and Develop Center
Department of Computer Science 
Peking University
Beijing, 100871, PRC
-- next part --
An HTML attachment was scrubbed...
URL: 



[PATCH 2/3] drm: replace the 'for' condition with outside defined variable

2015-03-17 Thread John Hunter
Hi Daniel,

On Tue, Mar 17, 2015 at 4:40 PM, Daniel Vetter  wrote:

> On Tue, Mar 17, 2015 at 03:30:27PM +0800, John Hunter wrote:
> > use outdise defined variable can reduce the recaculate of the
> > count of planes, crtcs and connectors.
> >
> > Signed-off-by: John Hunter 
>
> Hm, what's the benefit you see for this change? The lines aren't too long
> yet and we don't reuse the expression, so imo code readability isn't
> improved.
>
I change this just reference some other functions in the same file.
like,
 drm_atomic_helper_check_planes
 wait_for_fences
 ...
I really think we should keep the same coding style in the same file.
If I am wrong with that, just ignore this patch :-)

> -Daniel
> > ---
> >  drivers/gpu/drm/drm_atomic_helper.c | 9 ++---
> >  1 file changed, 6 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/drm_atomic_helper.c
> b/drivers/gpu/drm/drm_atomic_helper.c
> > index 39369ee..20376e6 100644
> > --- a/drivers/gpu/drm/drm_atomic_helper.c
> > +++ b/drivers/gpu/drm/drm_atomic_helper.c
> > @@ -1301,8 +1301,11 @@ void drm_atomic_helper_swap_state(struct
> drm_device *dev,
> > struct drm_atomic_state *state)
> >  {
> >   int i;
> > + int nconnectors = dev->mode_config.num_connector;
> > + int ncrtcs = dev->mode_config.num_crtc;
> > + int nplanes = dev->mode_config.num_total_plane;
> >
> > - for (i = 0; i < dev->mode_config.num_connector; i++) {
> > + for (i = 0; i < nconnectors; i++) {
> >   struct drm_connector *connector = state->connectors[i];
> >
> >   if (!connector)
> > @@ -1313,7 +1316,7 @@ void drm_atomic_helper_swap_state(struct
> drm_device *dev,
> >   connector->state->state = NULL;
> >   }
> >
> > - for (i = 0; i < dev->mode_config.num_crtc; i++) {
> > + for (i = 0; i < ncrtcs; i++) {
> >   struct drm_crtc *crtc = state->crtcs[i];
> >
> >   if (!crtc)
> > @@ -1324,7 +1327,7 @@ void drm_atomic_helper_swap_state(struct
> drm_device *dev,
> >   crtc->state->state = NULL;
> >   }
> >
> > - for (i = 0; i < dev->mode_config.num_total_plane; i++) {
> > + for (i = 0; i < nplanes; i++) {
> >   struct drm_plane *plane = state->planes[i];
> >
> >   if (!plane)
> > --
> > 1.9.1
> >
> >
> > ___
> > dri-devel mailing list
> > dri-devel at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/dri-devel
>
> --
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
>



-- 
Best regards
Junwang Zhao
Microprocessor Research and Develop Center
Department of Computer Science 
Peking University
Beijing, 100871, PRC
-- next part --
An HTML attachment was scrubbed...
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20150317/a2578300/attachment.html>


Why no geode subsystem contained in drm

2015-03-17 Thread John Hunter
Hi,

I noticed that there is no geode subsystem in the drm directory.
I have a system using the geode LX framebuffer and
xserver-xorg-video-geode. I am wondering if we can add the drm
part of geode lx to let it support the dri?

How about VIVANTE then?

Best Regards,
John

-- 
Best regards
Junwang Zhao
Microprocessor Research and Develop Center
Department of Computer Science 
Peking University
Beijing, 100871, PRC
-- next part --
An HTML attachment was scrubbed...
URL: 



[PATCH 3/3] drm: change connector to tmp_connector

2015-03-17 Thread John Hunter
This wasn't too harmful since we already look at connector,
which has the same effect as the loop for any non-cloned configs.
Only when we have a cloned configuration is it important to look
at other connectors. Furthermore existing userspace always changes
dpms on all of them anyway.

Signed-off-by: JohnHunter 
---
 drivers/gpu/drm/drm_atomic_helper.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_atomic_helper.c 
b/drivers/gpu/drm/drm_atomic_helper.c
index 20376e6..93b467d 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -2004,10 +2004,10 @@ retry:
WARN_ON(!drm_modeset_is_locked(>connection_mutex));

list_for_each_entry(tmp_connector, >connector_list, head) {
-   if (connector->state->crtc != crtc)
+   if (tmp_connector->state->crtc != crtc)
continue;

-   if (connector->dpms == DRM_MODE_DPMS_ON) {
+   if (tmp_connector->dpms == DRM_MODE_DPMS_ON) {
active = true;
break;
}
-- 
1.9.1




[PATCH 2/3] drm: replace the 'for' condition with outside defined variable

2015-03-17 Thread John Hunter
use outdise defined variable can reduce the recaculate of the
count of planes, crtcs and connectors.

Signed-off-by: John Hunter 
---
 drivers/gpu/drm/drm_atomic_helper.c | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/drm_atomic_helper.c 
b/drivers/gpu/drm/drm_atomic_helper.c
index 39369ee..20376e6 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -1301,8 +1301,11 @@ void drm_atomic_helper_swap_state(struct drm_device *dev,
  struct drm_atomic_state *state)
 {
int i;
+   int nconnectors = dev->mode_config.num_connector;
+   int ncrtcs = dev->mode_config.num_crtc;
+   int nplanes = dev->mode_config.num_total_plane;

-   for (i = 0; i < dev->mode_config.num_connector; i++) {
+   for (i = 0; i < nconnectors; i++) {
struct drm_connector *connector = state->connectors[i];

if (!connector)
@@ -1313,7 +1316,7 @@ void drm_atomic_helper_swap_state(struct drm_device *dev,
connector->state->state = NULL;
}

-   for (i = 0; i < dev->mode_config.num_crtc; i++) {
+   for (i = 0; i < ncrtcs; i++) {
struct drm_crtc *crtc = state->crtcs[i];

if (!crtc)
@@ -1324,7 +1327,7 @@ void drm_atomic_helper_swap_state(struct drm_device *dev,
crtc->state->state = NULL;
}

-   for (i = 0; i < dev->mode_config.num_total_plane; i++) {
+   for (i = 0; i < nplanes; i++) {
struct drm_plane *plane = state->planes[i];

if (!plane)
-- 
1.9.1




[PATCH 1/3] drm: Fix some typo mistake of the annotations

2015-03-17 Thread John Hunter
There are some mistakes that the function name in the annotaions
is not matching the real function name.
And some duplication word in annotations

Signed-off-by: John Hunter 
---
 drivers/gpu/drm/drm_atomic_helper.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/drm_atomic_helper.c 
b/drivers/gpu/drm/drm_atomic_helper.c
index a745881..39369ee 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -346,7 +346,7 @@ needs_modeset(struct drm_crtc_state *state)
 }

 /**
- * drm_atomic_helper_check - validate state object for modeset changes
+ * drm_atomic_helper_check_modeset - validate state object for modeset changes
  * @dev: DRM device
  * @state: the driver state object
  *
@@ -461,7 +461,7 @@ drm_atomic_helper_check_modeset(struct drm_device *dev,
 EXPORT_SYMBOL(drm_atomic_helper_check_modeset);

 /**
- * drm_atomic_helper_check - validate state object for modeset changes
+ * drm_atomic_helper_check_planes - validate state object for planes changes
  * @dev: DRM device
  * @state: the driver state object
  *
@@ -605,7 +605,7 @@ disable_outputs(struct drm_device *dev, struct 
drm_atomic_state *old_state)

/*
 * Each encoder has at most one connector (since we always steal
-* it away), so we won't call call disable hooks twice.
+* it away), so we won't call disable hooks twice.
 */
if (encoder->bridge)
encoder->bridge->funcs->disable(encoder->bridge);
@@ -757,7 +757,7 @@ crtc_set_mode(struct drm_device *dev, struct 
drm_atomic_state *old_state)

/*
 * Each encoder has at most one connector (since we always steal
-* it away), so we won't call call mode_set hooks twice.
+* it away), so we won't call mode_set hooks twice.
 */
if (funcs->mode_set)
funcs->mode_set(encoder, mode, adjusted_mode);
@@ -858,7 +858,7 @@ void drm_atomic_helper_commit_modeset_enables(struct 
drm_device *dev,

/*
 * Each encoder has at most one connector (since we always steal
-* it away), so we won't call call enable hooks twice.
+* it away), so we won't call enable hooks twice.
 */
if (encoder->bridge)
encoder->bridge->funcs->pre_enable(encoder->bridge);
@@ -1025,7 +1025,7 @@ int drm_atomic_helper_commit(struct drm_device *dev,

/*
 * Everything below can be run asynchronously without the need to grab
-* any modeset locks at all under one conditions: It must be guaranteed
+* any modeset locks at all under one condition: It must be guaranteed
 * that the asynchronous work has either been cancelled (if the driver
 * supports it, which at least requires that the framebuffers get
 * cleaned up with drm_atomic_helper_cleanup_planes()) or completed
-- 
1.9.1




[PATCH 2/2] drm_atomic_helper.c: connector => tmp_connector

2015-03-17 Thread John Hunter
Hi Daniel,

I've modified my patches and resend them, hope I do the right work flow
this time.
I am not good at english, so please forgive my dull :-(
I spent about two hours to figure out what does the "sob line missing"
means.
sob means Signed-off-by in case some others don't know. :-)

Please don't hesitate to criticize if I think I didn't do the right thing.

Thanks, John

On Mon, Mar 16, 2015 at 4:21 PM, Daniel Vetter  wrote:

> On Sun, Mar 15, 2015 at 08:59:11PM +0800, John Hunter wrote:
> > I'm not sure whether this is right, as far as I can see, for the
> > macro 'list_for_each_entry', if not use the tmp_connector, it does
> > make sense.
> >
> > Hope I am right with that.
>
> Nice catch and looks correct. But please follow patch submission
> guidelines from Documentation/SubmittingPatches. Here specifically:
> - sob line missing
> - Additional comments/questions should be below a line with just '---' so
>   that git apply-mbox drops it.
> - Polish the commit message a bit. This wasn't too harmful since we
>   already look at connector, which has the same effect as the loop for any
>   non-cloned configs. Only when we have a cloned configuration is it
>   important to look at other connectors. Furthermore existing userspace
>   always changes dpms on all of them anyway.
>
> Thanks, Daniel
> > ---
> >  drivers/gpu/drm/drm_atomic_helper.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/drm_atomic_helper.c
> b/drivers/gpu/drm/drm_atomic_helper.c
> > index bc17019..2abded1 100644
> > --- a/drivers/gpu/drm/drm_atomic_helper.c
> > +++ b/drivers/gpu/drm/drm_atomic_helper.c
> > @@ -2027,10 +2027,10 @@ retry:
> >   WARN_ON(!drm_modeset_is_locked(>connection_mutex));
> >
> >   list_for_each_entry(tmp_connector, >connector_list, head) {
> > - if (connector->state->crtc != crtc)
> > + if (tmp_connector->state->crtc != crtc)
> >   continue;
> >
> > - if (connector->dpms == DRM_MODE_DPMS_ON) {
> > + if (tmp_connector->dpms == DRM_MODE_DPMS_ON) {
> >   active = true;
> >   break;
> >   }
> > --
> > 1.9.1
> >
> >
> > ___
> > dri-devel mailing list
> > dri-devel at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/dri-devel
>
> --
> Daniel Vetter
> Software Engineer, Intel Corporation
> +41 (0) 79 365 57 48 - http://blog.ffwll.ch
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
>



-- 
Best regards
Junwang Zhao
Microprocessor Research and Develop Center
Department of Computer Science 
Peking University
Beijing, 100871, PRC
-- next part --
An HTML attachment was scrubbed...
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20150317/e8ec903a/attachment.html>


[PATCH 1/2] drm_atomic_helper.c: cosmetic: fix some typos and add some empty line

2015-03-16 Thread John Hunter
I will read the Documentation/SubmittingPatches,
sorry about my mistake.

On Mon, Mar 16, 2015 at 4:17 PM, Daniel Vetter  wrote:

> On Sun, Mar 15, 2015 at 08:59:10PM +0800, John Hunter wrote:
> > there are some duplication in the annotations
> > add some empty line to make it easier to read
>
> sob line missing. Also please split this up into individual parts, since I
> don't agree with the additional empty lines bikeshed. See
> Documentation/SubmittingPatches.
> -Daniel
>
> > ---
> >  drivers/gpu/drm/drm_atomic_helper.c | 48
> +
> >  1 file changed, 38 insertions(+), 10 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/drm_atomic_helper.c
> b/drivers/gpu/drm/drm_atomic_helper.c
> > index a745881..bc17019 100644
> > --- a/drivers/gpu/drm/drm_atomic_helper.c
> > +++ b/drivers/gpu/drm/drm_atomic_helper.c
> > @@ -346,7 +346,7 @@ needs_modeset(struct drm_crtc_state *state)
> >  }
> >
> >  /**
> > - * drm_atomic_helper_check - validate state object for modeset changes
> > + * drm_atomic_helper_check_modeset - validate state object for modeset
> changes
> >   * @dev: DRM device
> >   * @state: the driver state object
> >   *
> > @@ -461,7 +461,7 @@ drm_atomic_helper_check_modeset(struct drm_device
> *dev,
> >  EXPORT_SYMBOL(drm_atomic_helper_check_modeset);
> >
> >  /**
> > - * drm_atomic_helper_check - validate state object for modeset changes
> > + * drm_atomic_helper_check_planes - validate state object for planes
> changes
> >   * @dev: DRM device
> >   * @state: the driver state object
> >   *
> > @@ -605,7 +605,7 @@ disable_outputs(struct drm_device *dev, struct
> drm_atomic_state *old_state)
> >
> >   /*
> >* Each encoder has at most one connector (since we always
> steal
> > -  * it away), so we won't call call disable hooks twice.
> > +  * it away), so we won't call disable hooks twice.
> >*/
> >   if (encoder->bridge)
> >   encoder->bridge->funcs->disable(encoder->bridge);
> > @@ -757,7 +757,7 @@ crtc_set_mode(struct drm_device *dev, struct
> drm_atomic_state *old_state)
> >
> >   /*
> >* Each encoder has at most one connector (since we always
> steal
> > -  * it away), so we won't call call mode_set hooks twice.
> > +  * it away), so we won't call mode_set hooks twice.
> >*/
> >   if (funcs->mode_set)
> >   funcs->mode_set(encoder, mode, adjusted_mode);
> > @@ -858,7 +858,7 @@ void drm_atomic_helper_commit_modeset_enables(struct
> drm_device *dev,
> >
> >   /*
> >* Each encoder has at most one connector (since we always
> steal
> > -  * it away), so we won't call call enable hooks twice.
> > +  * it away), so we won't call enable hooks twice.
> >*/
> >   if (encoder->bridge)
> >
>  encoder->bridge->funcs->pre_enable(encoder->bridge);
> > @@ -1025,7 +1025,7 @@ int drm_atomic_helper_commit(struct drm_device
> *dev,
> >
> >   /*
> >* Everything below can be run asynchronously without the need to
> grab
> > -  * any modeset locks at all under one conditions: It must be
> guaranteed
> > +  * any modeset locks at all under one condition: It must be
> guaranteed
> >* that the asynchronous work has either been cancelled (if the
> driver
> >* supports it, which at least requires that the framebuffers get
> >* cleaned up with drm_atomic_helper_cleanup_planes()) or completed
> > @@ -1151,7 +1151,6 @@ fail:
> >
> >   if (fb && funcs->cleanup_fb)
> >   funcs->cleanup_fb(plane, fb, plane_state);
> > -
> >   }
> >
> >   return ret;
> > @@ -1301,8 +1300,11 @@ void drm_atomic_helper_swap_state(struct
> drm_device *dev,
> > struct drm_atomic_state *state)
> >  {
> >   int i;
> > + int nconnectors = dev->mode_config.num_connector;
> > + int ncrtcs = dev->mode_config.num_crtc;
> > + int nplanes = dev->mode_config.num_total_plane;
> >
> > - for (i = 0; i < dev->mode_config.num_connector; i++) {
> > + for (i = 0; i < nconnectors; i++) {
> >   struct drm_connector *connector = state->connectors[i];
> >
> >  

[PATCH 2/2] drm_atomic_helper.c: connector => tmp_connector

2015-03-15 Thread John Hunter
I'm not sure whether this is right, as far as I can see, for the
macro 'list_for_each_entry', if not use the tmp_connector, it does
make sense.

Hope I am right with that.
---
 drivers/gpu/drm/drm_atomic_helper.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_atomic_helper.c 
b/drivers/gpu/drm/drm_atomic_helper.c
index bc17019..2abded1 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -2027,10 +2027,10 @@ retry:
WARN_ON(!drm_modeset_is_locked(>connection_mutex));

list_for_each_entry(tmp_connector, >connector_list, head) {
-   if (connector->state->crtc != crtc)
+   if (tmp_connector->state->crtc != crtc)
continue;

-   if (connector->dpms == DRM_MODE_DPMS_ON) {
+   if (tmp_connector->dpms == DRM_MODE_DPMS_ON) {
active = true;
break;
}
-- 
1.9.1




[PATCH 1/2] drm_atomic_helper.c: cosmetic: fix some typos and add some empty line

2015-03-15 Thread John Hunter
there are some duplication in the annotations
add some empty line to make it easier to read
---
 drivers/gpu/drm/drm_atomic_helper.c | 48 +
 1 file changed, 38 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/drm_atomic_helper.c 
b/drivers/gpu/drm/drm_atomic_helper.c
index a745881..bc17019 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -346,7 +346,7 @@ needs_modeset(struct drm_crtc_state *state)
 }

 /**
- * drm_atomic_helper_check - validate state object for modeset changes
+ * drm_atomic_helper_check_modeset - validate state object for modeset changes
  * @dev: DRM device
  * @state: the driver state object
  *
@@ -461,7 +461,7 @@ drm_atomic_helper_check_modeset(struct drm_device *dev,
 EXPORT_SYMBOL(drm_atomic_helper_check_modeset);

 /**
- * drm_atomic_helper_check - validate state object for modeset changes
+ * drm_atomic_helper_check_planes - validate state object for planes changes
  * @dev: DRM device
  * @state: the driver state object
  *
@@ -605,7 +605,7 @@ disable_outputs(struct drm_device *dev, struct 
drm_atomic_state *old_state)

/*
 * Each encoder has at most one connector (since we always steal
-* it away), so we won't call call disable hooks twice.
+* it away), so we won't call disable hooks twice.
 */
if (encoder->bridge)
encoder->bridge->funcs->disable(encoder->bridge);
@@ -757,7 +757,7 @@ crtc_set_mode(struct drm_device *dev, struct 
drm_atomic_state *old_state)

/*
 * Each encoder has at most one connector (since we always steal
-* it away), so we won't call call mode_set hooks twice.
+* it away), so we won't call mode_set hooks twice.
 */
if (funcs->mode_set)
funcs->mode_set(encoder, mode, adjusted_mode);
@@ -858,7 +858,7 @@ void drm_atomic_helper_commit_modeset_enables(struct 
drm_device *dev,

/*
 * Each encoder has at most one connector (since we always steal
-* it away), so we won't call call enable hooks twice.
+* it away), so we won't call enable hooks twice.
 */
if (encoder->bridge)
encoder->bridge->funcs->pre_enable(encoder->bridge);
@@ -1025,7 +1025,7 @@ int drm_atomic_helper_commit(struct drm_device *dev,

/*
 * Everything below can be run asynchronously without the need to grab
-* any modeset locks at all under one conditions: It must be guaranteed
+* any modeset locks at all under one condition: It must be guaranteed
 * that the asynchronous work has either been cancelled (if the driver
 * supports it, which at least requires that the framebuffers get
 * cleaned up with drm_atomic_helper_cleanup_planes()) or completed
@@ -1151,7 +1151,6 @@ fail:

if (fb && funcs->cleanup_fb)
funcs->cleanup_fb(plane, fb, plane_state);
-
}

return ret;
@@ -1301,8 +1300,11 @@ void drm_atomic_helper_swap_state(struct drm_device *dev,
  struct drm_atomic_state *state)
 {
int i;
+   int nconnectors = dev->mode_config.num_connector;
+   int ncrtcs = dev->mode_config.num_crtc;
+   int nplanes = dev->mode_config.num_total_plane;

-   for (i = 0; i < dev->mode_config.num_connector; i++) {
+   for (i = 0; i < nconnectors; i++) {
struct drm_connector *connector = state->connectors[i];

if (!connector)
@@ -1313,7 +1315,7 @@ void drm_atomic_helper_swap_state(struct drm_device *dev,
connector->state->state = NULL;
}

-   for (i = 0; i < dev->mode_config.num_crtc; i++) {
+   for (i = 0; i < ncrtcs; i++) {
struct drm_crtc *crtc = state->crtcs[i];

if (!crtc)
@@ -1324,7 +1326,7 @@ void drm_atomic_helper_swap_state(struct drm_device *dev,
crtc->state->state = NULL;
}

-   for (i = 0; i < dev->mode_config.num_total_plane; i++) {
+   for (i = 0; i < nplanes; i++) {
struct drm_plane *plane = state->planes[i];

if (!plane)
@@ -1373,6 +1375,7 @@ int drm_atomic_helper_update_plane(struct drm_plane 
*plane,
return -ENOMEM;

state->acquire_ctx = drm_modeset_legacy_acquire_ctx(crtc);
+
 retry:
plane_state = drm_atomic_get_plane_state(state, plane);
if (IS_ERR(plane_state)) {
@@ -1402,6 +1405,7 @@ retry:

/* Driver takes ownership of state on successful commit. */
return 0;
+
 fail:
if (ret == -EDEADLK)
goto backoff;
@@ -1409,6 +1413,7 @@ fail:
drm_atomic_state_free(state);

return ret;
+
 backoff:
drm_atomic_state_clear(state);

Connection to the remote recipient's server was denied for unknown reason

2015-03-15 Thread John Hunter
Hi,
I was trying to send some patches using git send email, but I got the error
msg:
"Connection to the remote recipient's server was denied for unknown reason"
Can anybody help?

-- 
Best regards
Junwang Zhao
Microprocessor Research and Develop Center
Department of Computer Science 
Peking University
Beijing, 100871, PRC
-- next part --
An HTML attachment was scrubbed...
URL: 



[PATCH] drm_crtc.c: fix some typo mistake and some annotations mistake

2015-03-14 Thread John Hunter
Hi Jani,

I did as you told me, I subscribed using my other email address, and
disable the mail delivery option in the management page of dri-devel.

Hope this may work.
Thanks.

Best regards,
John

On Fri, Mar 13, 2015 at 8:34 PM, Jani Nikula 
wrote:

> On Fri, 13 Mar 2015, Rob Clark  wrote:
> > hopefully someone else in China can suggest a good way of sending
> > patches (I have no clue there)
>
> An alternative is to subscribe with all email addresses you may be
> sending patches (or messages) from, but disabling list mail delivery for
> all but one address in the dri-devel list management interface.
>
> You can have git format-patch/send-email add a From: line at the
> beginning of the patch (separate from mail headers) matching the
> Signed-off-by. I forget the config for this, but it's there somewhere.
>
>
> HTH,
> Jani.
>
>
> --
> Jani Nikula, Intel Open Source Technology Center
>



-- 
Best regards
Junwang Zhao
Microprocessor Research and Develop Center
Department of Computer Science 
Peking University
Beijing, 100871, PRC
-- next part --
An HTML attachment was scrubbed...
URL: 



[PATCH] drm_crtc.c: fix some typo mistake and some annotations mistake

2015-03-13 Thread John Hunter
Fine, I will try to catch up.
Thanks anyway.

Have a nice day,
John

On Fri, Mar 13, 2015 at 11:07 AM, Rob Clark  wrote:

> On Thu, Mar 12, 2015 at 10:53 PM, John Hunter  wrote:
> > Got it, maybe I should work on the drm-next or latest linux master.
> >
> > I am working on the drm git repo below for now as Daniel Vetter told me
> > git://people.freedesktop.org/~airlied/linux
> > I am quite confused now 'cause there are a bounch of git repo, I really
> > do not know which one should I git clone.
> >
>
> Hmm, I suspect airlied hasn't updated his master branch in a while,
> which is probably causing confusing..  using his drm-next branch or
> linus master would be better..  in general, drm-next for latest and
> greatest drm is probably best, but right at the moment there is
> probably not much difference from linus master.
>
> I usually end up 'git remote add'ing a bunch of different trees to
> track both what has already landed in linus's master branch, and also
> what is coming in drm-next (and various different arm trees related to
> other stuff I work on)..  but for drm stuff, Dave's drm-next branch is
> a safe bet.
>
> BR,
> -R
>
>
> >
> > On Fri, Mar 13, 2015 at 10:33 AM, Rob Clark  wrote:
> >>
> >> On Thu, Mar 12, 2015 at 4:02 AM, John Hunter 
> >> wrote:
> >> > From: John Hunter 
> >> >
> >> > IMHO, some annotations were copypaste from somewhere else, it is
> >> > obviously not rightly modified. Hope I am right with that.
> >> > ---
> >> >  drivers/gpu/drm/drm_crtc.c | 115
> >> > ++---
> >> >  1 file changed, 56 insertions(+), 59 deletions(-)
> >> >
> >> > diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> >> > index f2d667b..7f771e9 100644
> >> > --- a/drivers/gpu/drm/drm_crtc.c
> >> > +++ b/drivers/gpu/drm/drm_crtc.c
> >> > @@ -205,12 +205,12 @@ char *drm_get_connector_status_name(enum
> >> > drm_connector_status status)
> >> >  /**
> >> >   * drm_mode_object_get - allocate a new identifier
> >> >   * @dev: DRM device
> >> > - * @ptr: object pointer, used to generate unique ID
> >> > - * @type: object type
> >> > + * @obj: object pointer, used to generate unique ID
> >> > + * @obj_type: object type
> >> >   *
> >> >   * LOCKING:
> >> >   *
> >> > - * Create a unique identifier based on @ptr in @dev's identifier
> space.
> >> > Used
> >> > + * Create a unique identifier based on @obj in @dev's identifier
> space.
> >> > Used
> >> >   * for tracking modes, CRTCs and connectors.
> >>
> >> so, I don't suppose you can rebase against a newer upstream kernel?
> >>
> >> From a quick look, it seems like the arg name errors where corrected
> >> in 065a50ed3ef75cb265e12e3e1b615db0835150bc while the description
> >> bodies fixes from your patch are still applicable.  In the current
> >> form, the patch does not apply against drm-next (or latest linux
> >> master), but most of it is still applicable and would be a very
> >> welcome improvement.
> >>
> >> Thanks :-)
> >>
> >> BR,
> >> -R
> >>
>



-- 
Best regards
Junwang Zhao
Microprocessor Research and Develop Center
Department of Computer Science 
Peking University
Beijing, 100871, PRC
-- next part --
An HTML attachment was scrubbed...
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20150313/d9f4d797/attachment.html>


[PATCH] drm_crtc.c: fix some typo mistake and some annotations mistake

2015-03-13 Thread John Hunter
Got it, maybe I should work on the drm-next or latest linux master.

I am working on the drm git repo below for now as Daniel Vetter told me
git://people.freedesktop.org/~airlied/linux
I am quite confused now 'cause there are a bounch of git repo, I really
do not know which one should I git clone.


On Fri, Mar 13, 2015 at 10:33 AM, Rob Clark  wrote:

> On Thu, Mar 12, 2015 at 4:02 AM, John Hunter 
> wrote:
> > From: John Hunter 
> >
> > IMHO, some annotations were copypaste from somewhere else, it is
> > obviously not rightly modified. Hope I am right with that.
> > ---
> >  drivers/gpu/drm/drm_crtc.c | 115
> ++---
> >  1 file changed, 56 insertions(+), 59 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> > index f2d667b..7f771e9 100644
> > --- a/drivers/gpu/drm/drm_crtc.c
> > +++ b/drivers/gpu/drm/drm_crtc.c
> > @@ -205,12 +205,12 @@ char *drm_get_connector_status_name(enum
> drm_connector_status status)
> >  /**
> >   * drm_mode_object_get - allocate a new identifier
> >   * @dev: DRM device
> > - * @ptr: object pointer, used to generate unique ID
> > - * @type: object type
> > + * @obj: object pointer, used to generate unique ID
> > + * @obj_type: object type
> >   *
> >   * LOCKING:
> >   *
> > - * Create a unique identifier based on @ptr in @dev's identifier
> space.  Used
> > + * Create a unique identifier based on @obj in @dev's identifier
> space.  Used
> >   * for tracking modes, CRTCs and connectors.
>
> so, I don't suppose you can rebase against a newer upstream kernel?
>
> From a quick look, it seems like the arg name errors where corrected
> in 065a50ed3ef75cb265e12e3e1b615db0835150bc while the description
> bodies fixes from your patch are still applicable.  In the current
> form, the patch does not apply against drm-next (or latest linux
> master), but most of it is still applicable and would be a very
> welcome improvement.
>
> Thanks :-)
>
> BR,
> -R
>
>
> >   *
> >   * RETURNS:
> > @@ -245,12 +245,12 @@ again:
> >  /**
> >   * drm_mode_object_put - free an identifer
> >   * @dev: DRM device
> > - * @id: ID to free
> > + * @object: object to free
> >   *
> >   * LOCKING:
> >   * Caller must hold DRM mode_config lock.
> >   *
> > - * Free @id from @dev's unique identifier pool.
> > + * Free @object from @dev's unique identifier pool.
> >   */
> >  static void drm_mode_object_put(struct drm_device *dev,
> > struct drm_mode_object *object)
> > @@ -353,10 +353,11 @@ EXPORT_SYMBOL(drm_framebuffer_reference);
> >  void drm_framebuffer_cleanup(struct drm_framebuffer *fb)
> >  {
> > struct drm_device *dev = fb->dev;
> > +
> > /*
> >  * This could be moved to drm_framebuffer_remove(), but for
> >  * debugging is nice to keep around the list of fb's that are
> > -* no longer associated w/ a drm_file but are not unreferenced
> > +* no longer associated with a drm_file but are not unreferenced
> >  * yet.  (i915 and omapdrm have debugfs files which will show
> >  * this.)
> >  */
> > @@ -519,7 +520,7 @@ EXPORT_SYMBOL(drm_mode_remove);
> >   * @dev: DRM device
> >   * @connector: the connector to init
> >   * @funcs: callbacks for this connector
> > - * @name: user visible name of the connector
> > + * @connector_type: type of the connector
> >   *
> >   * LOCKING:
> >   * Takes mode config lock.
> > @@ -683,7 +684,8 @@ int drm_plane_init(struct drm_device *dev, struct
> drm_plane *plane,
> > plane->format_count = format_count;
> > plane->possible_crtcs = possible_crtcs;
> >
> > -   /* private planes are not exposed to userspace, but depending on
> > +   /*
> > +* private planes are not exposed to userspace, but depending on
> >  * display hardware, might be convenient to allow sharing
> programming
> >  * for the scanout engine with the crtc implementation.
> >  */
> > @@ -1188,10 +1190,9 @@ static int drm_crtc_convert_umode(struct
> drm_display_mode *out,
> >
> >  /**
> >   * drm_mode_getresources - get graphics configuration
> > - * @inode: inode from the ioctl
> > - * @filp: file * from the ioctl
> > - * @cmd: cmd from ioctl
> > - * @arg: arg from ioctl
> > + * @dev: DRM device
> > + * @data: ioctl d

[PATCH] drm_crtc.c: fix some typo mistake and some annotations mistake

2015-03-13 Thread John Hunter
Hi Rob,

On Thu, Mar 12, 2015 at 10:34 PM, Rob Clark  wrote:

> On Thu, Mar 12, 2015 at 10:15 AM, John Hunter  wrote:
> > Hi,
> > I really don't  whether I am doing things on right workflow of dri-devel.
> > I am new to this community and I want to help.
> > Could anybody spare some time to tell me the right way .
> > Thanks.
>
> Hi John,
>
> I don't actually see the original patch, just your reply to it..  if
> you didn't already, could you git-send-email it to dri-devel?
>
> I searched the archieve of the maillinglist, I think this may be the
original patch
http://lists.freedesktop.org/archives/dri-devel/2015-March/079198.html


> (If you did, but were not subscribed, perhaps it is still stuck in
> list moderation queue?)
>
> I subscribed with the email : zhjwpku at gmail.com, but when git-send-email
to dri-devel,
I used another not subscribed email: zhaojunwang at pku.edu.cn to git-send the
patch ,
because I got trouble when I use the gmail stmp server in git-send-mail
I can only use the gmail under the help of chrome and goagent, cause I am
in China :-(

BR,
John


> BR,
> -R
>
>
> > John
> >
> > On Thu, Mar 12, 2015 at 4:02 PM, John Hunter 
> wrote:
> >>
> >> From: John Hunter 
> >>
> >> IMHO, some annotations were copypaste from somewhere else, it is
> >> obviously not rightly modified. Hope I am right with that.
> >> ---
> >>  drivers/gpu/drm/drm_crtc.c | 115
> >> ++---
> >>  1 file changed, 56 insertions(+), 59 deletions(-)
> >>
> >> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> >> index f2d667b..7f771e9 100644
> >> --- a/drivers/gpu/drm/drm_crtc.c
> >> +++ b/drivers/gpu/drm/drm_crtc.c
> >> @@ -205,12 +205,12 @@ char *drm_get_connector_status_name(enum
> >> drm_connector_status status)
> >>  /**
> >>   * drm_mode_object_get - allocate a new identifier
> >>   * @dev: DRM device
> >> - * @ptr: object pointer, used to generate unique ID
> >> - * @type: object type
> >> + * @obj: object pointer, used to generate unique ID
> >> + * @obj_type: object type
> >>   *
> >>   * LOCKING:
> >>   *
> >> - * Create a unique identifier based on @ptr in @dev's identifier space.
> >> Used
> >> + * Create a unique identifier based on @obj in @dev's identifier space.
> >> Used
> >>   * for tracking modes, CRTCs and connectors.
> >>   *
> >>   * RETURNS:
> >> @@ -245,12 +245,12 @@ again:
> >>  /**
> >>   * drm_mode_object_put - free an identifer
> >>   * @dev: DRM device
> >> - * @id: ID to free
> >> + * @object: object to free
> >>   *
> >>   * LOCKING:
> >>   * Caller must hold DRM mode_config lock.
> >>   *
> >> - * Free @id from @dev's unique identifier pool.
> >> + * Free @object from @dev's unique identifier pool.
> >>   */
> >>  static void drm_mode_object_put(struct drm_device *dev,
> >> struct drm_mode_object *object)
> >> @@ -353,10 +353,11 @@ EXPORT_SYMBOL(drm_framebuffer_reference);
> >>  void drm_framebuffer_cleanup(struct drm_framebuffer *fb)
> >>  {
> >> struct drm_device *dev = fb->dev;
> >> +
> >> /*
> >>  * This could be moved to drm_framebuffer_remove(), but for
> >>  * debugging is nice to keep around the list of fb's that are
> >> -* no longer associated w/ a drm_file but are not unreferenced
> >> +* no longer associated with a drm_file but are not unreferenced
> >>  * yet.  (i915 and omapdrm have debugfs files which will show
> >>  * this.)
> >>  */
> >> @@ -519,7 +520,7 @@ EXPORT_SYMBOL(drm_mode_remove);
> >>   * @dev: DRM device
> >>   * @connector: the connector to init
> >>   * @funcs: callbacks for this connector
> >> - * @name: user visible name of the connector
> >> + * @connector_type: type of the connector
> >>   *
> >>   * LOCKING:
> >>   * Takes mode config lock.
> >> @@ -683,7 +684,8 @@ int drm_plane_init(struct drm_device *dev, struct
> >> drm_plane *plane,
> >> plane->format_count = format_count;
> >> plane->possible_crtcs = possible_crtcs;
> >>
> >> -   /* private planes are not exposed to userspace, but depending on
> >> +   /*
> >> +* private planes are not exposed to usersp

[PATCH] drm_crtc.c: fix some typo mistake and some annotations mistake

2015-03-12 Thread John Hunter
Hi,
I really don't  whether I am doing things on right workflow of dri-devel.
I am new to this community and I want to help.
Could anybody spare some time to tell me the right way .
Thanks.

John

On Thu, Mar 12, 2015 at 4:02 PM, John Hunter  wrote:

> From: John Hunter 
>
> IMHO, some annotations were copypaste from somewhere else, it is
> obviously not rightly modified. Hope I am right with that.
> ---
>  drivers/gpu/drm/drm_crtc.c | 115
> ++---
>  1 file changed, 56 insertions(+), 59 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> index f2d667b..7f771e9 100644
> --- a/drivers/gpu/drm/drm_crtc.c
> +++ b/drivers/gpu/drm/drm_crtc.c
> @@ -205,12 +205,12 @@ char *drm_get_connector_status_name(enum
> drm_connector_status status)
>  /**
>   * drm_mode_object_get - allocate a new identifier
>   * @dev: DRM device
> - * @ptr: object pointer, used to generate unique ID
> - * @type: object type
> + * @obj: object pointer, used to generate unique ID
> + * @obj_type: object type
>   *
>   * LOCKING:
>   *
> - * Create a unique identifier based on @ptr in @dev's identifier space.
> Used
> + * Create a unique identifier based on @obj in @dev's identifier space.
> Used
>   * for tracking modes, CRTCs and connectors.
>   *
>   * RETURNS:
> @@ -245,12 +245,12 @@ again:
>  /**
>   * drm_mode_object_put - free an identifer
>   * @dev: DRM device
> - * @id: ID to free
> + * @object: object to free
>   *
>   * LOCKING:
>   * Caller must hold DRM mode_config lock.
>   *
> - * Free @id from @dev's unique identifier pool.
> + * Free @object from @dev's unique identifier pool.
>   */
>  static void drm_mode_object_put(struct drm_device *dev,
> struct drm_mode_object *object)
> @@ -353,10 +353,11 @@ EXPORT_SYMBOL(drm_framebuffer_reference);
>  void drm_framebuffer_cleanup(struct drm_framebuffer *fb)
>  {
> struct drm_device *dev = fb->dev;
> +
> /*
>  * This could be moved to drm_framebuffer_remove(), but for
>  * debugging is nice to keep around the list of fb's that are
> -* no longer associated w/ a drm_file but are not unreferenced
> +* no longer associated with a drm_file but are not unreferenced
>  * yet.  (i915 and omapdrm have debugfs files which will show
>  * this.)
>  */
> @@ -519,7 +520,7 @@ EXPORT_SYMBOL(drm_mode_remove);
>   * @dev: DRM device
>   * @connector: the connector to init
>   * @funcs: callbacks for this connector
> - * @name: user visible name of the connector
> + * @connector_type: type of the connector
>   *
>   * LOCKING:
>   * Takes mode config lock.
> @@ -683,7 +684,8 @@ int drm_plane_init(struct drm_device *dev, struct
> drm_plane *plane,
> plane->format_count = format_count;
> plane->possible_crtcs = possible_crtcs;
>
> -   /* private planes are not exposed to userspace, but depending on
> +   /*
> +* private planes are not exposed to userspace, but depending on
>  * display hardware, might be convenient to allow sharing
> programming
>  * for the scanout engine with the crtc implementation.
>  */
> @@ -1188,10 +1190,9 @@ static int drm_crtc_convert_umode(struct
> drm_display_mode *out,
>
>  /**
>   * drm_mode_getresources - get graphics configuration
> - * @inode: inode from the ioctl
> - * @filp: file * from the ioctl
> - * @cmd: cmd from ioctl
> - * @arg: arg from ioctl
> + * @dev: DRM device
> + * @data: ioctl data
> + * @file_priv: DRM file info
>   *
>   * LOCKING:
>   * Takes mode config lock.
> @@ -1249,7 +1250,6 @@ int drm_mode_getresources(struct drm_device *dev,
> void *data,
> list_for_each(lh, >mode_config.encoder_list)
> encoder_count++;
> } else {
> -
> crtc_count = mode_group->num_crtcs;
> connector_count = mode_group->num_connectors;
> encoder_count = mode_group->num_encoders;
> @@ -1328,7 +1328,6 @@ int drm_mode_getresources(struct drm_device *dev,
> void *data,
> }
> copied++;
> }
> -
> }
> }
> card_res->count_encoders = encoder_count;
> @@ -1376,10 +1375,9 @@ out:
>
>  /**
>   * drm_mode_getcrtc - get CRTC configuration
> - * @inode: inode from the ioctl
> - * @filp: file * from the ioctl
> - * @cmd: cmd from ioctl
> - * @arg: arg from ioctl
> + * @dev: DRM device
> + * @data: ioctl data
> + * @file_priv: DRM file info
>   *
>   *

[PATCH] drm_crtc.c: fix some typo mistake and some annotations mistake

2015-03-12 Thread John Hunter
From: John Hunter <zhjw...@gmail.com>

IMHO, some annotations were copypaste from somewhere else, it is
obviously not rightly modified. Hope I am right with that.
---
 drivers/gpu/drm/drm_crtc.c | 115 ++---
 1 file changed, 56 insertions(+), 59 deletions(-)

diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index f2d667b..7f771e9 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -205,12 +205,12 @@ char *drm_get_connector_status_name(enum 
drm_connector_status status)
 /**
  * drm_mode_object_get - allocate a new identifier
  * @dev: DRM device
- * @ptr: object pointer, used to generate unique ID
- * @type: object type
+ * @obj: object pointer, used to generate unique ID
+ * @obj_type: object type
  *
  * LOCKING:
  *
- * Create a unique identifier based on @ptr in @dev's identifier space.  Used
+ * Create a unique identifier based on @obj in @dev's identifier space.  Used
  * for tracking modes, CRTCs and connectors.
  *
  * RETURNS:
@@ -245,12 +245,12 @@ again:
 /**
  * drm_mode_object_put - free an identifer
  * @dev: DRM device
- * @id: ID to free
+ * @object: object to free
  *
  * LOCKING:
  * Caller must hold DRM mode_config lock.
  *
- * Free @id from @dev's unique identifier pool.
+ * Free @object from @dev's unique identifier pool.
  */
 static void drm_mode_object_put(struct drm_device *dev,
struct drm_mode_object *object)
@@ -353,10 +353,11 @@ EXPORT_SYMBOL(drm_framebuffer_reference);
 void drm_framebuffer_cleanup(struct drm_framebuffer *fb)
 {
struct drm_device *dev = fb->dev;
+
/*
 * This could be moved to drm_framebuffer_remove(), but for
 * debugging is nice to keep around the list of fb's that are
-* no longer associated w/ a drm_file but are not unreferenced
+* no longer associated with a drm_file but are not unreferenced
 * yet.  (i915 and omapdrm have debugfs files which will show
 * this.)
 */
@@ -519,7 +520,7 @@ EXPORT_SYMBOL(drm_mode_remove);
  * @dev: DRM device
  * @connector: the connector to init
  * @funcs: callbacks for this connector
- * @name: user visible name of the connector
+ * @connector_type: type of the connector
  *
  * LOCKING:
  * Takes mode config lock.
@@ -683,7 +684,8 @@ int drm_plane_init(struct drm_device *dev, struct drm_plane 
*plane,
plane->format_count = format_count;
plane->possible_crtcs = possible_crtcs;

-   /* private planes are not exposed to userspace, but depending on
+   /*
+* private planes are not exposed to userspace, but depending on
 * display hardware, might be convenient to allow sharing programming
 * for the scanout engine with the crtc implementation.
 */
@@ -1188,10 +1190,9 @@ static int drm_crtc_convert_umode(struct 
drm_display_mode *out,

 /**
  * drm_mode_getresources - get graphics configuration
- * @inode: inode from the ioctl
- * @filp: file * from the ioctl
- * @cmd: cmd from ioctl
- * @arg: arg from ioctl
+ * @dev: DRM device
+ * @data: ioctl data
+ * @file_priv: DRM file info
  *
  * LOCKING:
  * Takes mode config lock.
@@ -1249,7 +1250,6 @@ int drm_mode_getresources(struct drm_device *dev, void 
*data,
list_for_each(lh, >mode_config.encoder_list)
encoder_count++;
} else {
-
crtc_count = mode_group->num_crtcs;
connector_count = mode_group->num_connectors;
encoder_count = mode_group->num_encoders;
@@ -1328,7 +1328,6 @@ int drm_mode_getresources(struct drm_device *dev, void 
*data,
}
copied++;
}
-
}
}
card_res->count_encoders = encoder_count;
@@ -1376,10 +1375,9 @@ out:

 /**
  * drm_mode_getcrtc - get CRTC configuration
- * @inode: inode from the ioctl
- * @filp: file * from the ioctl
- * @cmd: cmd from ioctl
- * @arg: arg from ioctl
+ * @dev: DRM device
+ * @data: ioctl data
+ * @file_priv: DRM file info
  *
  * LOCKING:
  * Takes mode config lock.
@@ -1421,10 +1419,8 @@ int drm_mode_getcrtc(struct drm_device *dev,
crtc_resp->fb_id = 0;

if (crtc->enabled) {
-
drm_crtc_convert_to_umode(_resp->mode, >mode);
crtc_resp->mode_valid = 1;
-
} else {
crtc_resp->mode_valid = 0;
}
@@ -1436,10 +1432,9 @@ out:

 /**
  * drm_mode_getconnector - get connector configuration
- * @inode: inode from the ioctl
- * @filp: file * from the ioctl
- * @cmd: cmd from ioctl
- * @arg: arg from ioctl
+ * @dev: DRM device
+ * @data: ioctl data
+ * @file_priv: DRM file info
  *
  * LOCKING:
  * Takes mode config lock.
@@ -1732,8 +1727,8 @@ out:
 /**
  * drm_mode_setplane - set up or tear down an plane
  * @dev: DRM device
- * @data: ioctl data*
- * @file_prive: DRM fil

GSOC 2015 project mentor

2015-03-09 Thread John Hunter
Hi Stefan,

I came across to contact to Martin Peres the last two days, I asked him
about the project "GL/GLSL tests for GL 4.0 and newer", he told me that
this was copy-pasted from last years idea.

Hope this can help you.

John


On Sun, Mar 8, 2015 at 4:46 AM, Stefan Lance  wrote:

> Hello,
>
> Who should I contact about / who is the mentor for the project titled
> "GL/GLSL tests for GL 4.0 and newer"?
>
> Thanks,
> Stefan Lance
>
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
>
>


-- 
Best regards
Junwang Zhao
Microprocessor Research and Develop Center
Department of Computer Science 
Peking University
Beijing, 100871, PRC
-- next part --
An HTML attachment was scrubbed...
URL: