{
/* pipe is -1 */
canFlip = FALSE;
- XDBG_WARNING(MDRI2, "pipe is -1");
+#ifndef NO_CRTC_MODE
+ XDBG_WARNING(MDRI2, "pipe is -1\n");
+#endif
}
}
(pSec->dump_xid == 0 || pSec->dump_xid == pDraw->id))
_saveDrawable (pDraw, pBackBuf, swap_type);
+#ifdef NO_CRTC_MODE
+ if (pSec->isCrtcOn == FALSE)
+ {
+ _asyncSwapBuffers (pClient, pDraw, pFrameEvent);
+ _SendSyncDrawDoneMessage(pScreen, pClient, pDraw);
+ _deleteFrame (pDraw, pFrameEvent);
+ return TRUE;
+ }
+ else
+#endif //NO_CRTC_MODE
/* If lcd is off status, SwapBuffers do not consider the vblank sync.
* The client that launches after lcd is off wants to render the frame
* on the fly.
tbm_bo *bos;
tbm_bo_handle bo_handle;
SECFbBoDataPtr bo_data;
- int num_bo;
+ int num_bo = 0;
int ret;
XDBG_RETURN_VAL_IF_FAIL ((privPixmap != NULL), NULL);
}
else
{
+
+#ifdef NO_CRTC_MODE
+ if (num_bo == 0)
+ {
+ num_bo = 1;
+ bos = (tbm_bo *)calloc(1, sizeof(tbm_bo *));
+ bos[0] = pSec->pFb->default_bo;
+ }
+#endif //NO_CRTC_MODE
+
op->num = num_bo;
op->isSame = 0;
#include "sec_accel.h"
#include "sec_drm_ipp.h"
#include "fimg2d.h"
+#include "xf86RandR12.h"
static void _cursorRegisterBlockHandler (xf86CrtcPtr pCrtc);
static void _cursorUnregisterBlockHandler (xf86CrtcPtr pCrtc);
{
SECModePtr pSecMode = (SECModePtr) SECPTR (pCrtc->scrn)->pSecMode;
SECCrtcPrivPtr pCrtcPriv = pCrtc->driver_private;
+ if (pCrtcPriv == NULL)
+ return FALSE;
if (move_layer)
{
_overlayEnsureLayer (xf86CrtcPtr pCrtc)
{
SECCrtcPrivPtr pCrtcPriv = pCrtc->driver_private;
+ if ( pCrtcPriv == NULL)
+ return FALSE;
int connector_type;
SECLayerOutput output = LAYER_OUTPUT_LCD;
SECLayer *layer;
_overlaySelectBuffer (xf86CrtcPtr pCrtc, Bool move_layer)
{
SECCrtcPrivPtr pCrtcPriv = pCrtc->driver_private;
+ if (pCrtcPriv == NULL)
+ return FALSE;
SECModePtr pSecMode = (SECModePtr) SECPTR (pCrtc->scrn)->pSecMode;
if (!_overlayEnsureLayer (pCrtc))
_cursorEnsureCursorImage(xf86CrtcPtr pCrtc)
{
SECCrtcPrivPtr pCrtcPriv = pCrtc->driver_private;
+ if (pCrtcPriv == NULL)
+ return FALSE;
SECPtr pSec = SECPTR (pCrtc->scrn);
int x, y, cursor_x, cursor_y;
_cursorEnsureCanvas (xf86CrtcPtr pCrtc, SECVideoBuf *vbuf, int width, int height)
{
SECCrtcPrivPtr pCrtcPriv = pCrtc->driver_private;
+ if (pCrtcPriv == NULL)
+ return FALSE;
tbm_bo_handle bo_handle;
if (pCrtcPriv->ovl_canvas)
_cursorEnsureSavedImage (xf86CrtcPtr pCrtc)
{
SECCrtcPrivPtr pCrtcPriv = pCrtc->driver_private;
-
+ if (pCrtcPriv == NULL)
+ return FALSE;
if (pCrtcPriv->saved_image)
return TRUE;
_cursorSaveImage (xf86CrtcPtr pCrtc)
{
SECCrtcPrivPtr pCrtcPriv = pCrtc->driver_private;
+ if (pCrtcPriv == NULL)
+ return;
SECModePtr pSecMode = (SECModePtr) SECPTR (pCrtc->scrn)->pSecMode;
XDBG_RETURN_IF_FAIL (pCrtcPriv->move_layer == FALSE);
_cursorRestoreImage (xf86CrtcPtr pCrtc)
{
SECCrtcPrivPtr pCrtcPriv = pCrtc->driver_private;
+ if (pCrtcPriv == NULL)
+ return;
if (!pCrtcPriv->saved_image || !pCrtcPriv->ovl_canvas)
return;
_cursorDrawCursor (xf86CrtcPtr pCrtc)
{
SECCrtcPrivPtr pCrtcPriv = pCrtc->driver_private;
+ if (pCrtcPriv == NULL)
+ return;
int x, y;
XDBG_RETURN_IF_FAIL (pCrtcPriv->ovl_canvas != NULL);
{
xf86CrtcPtr pCrtc = (xf86CrtcPtr)closure;
SECCrtcPrivPtr pCrtcPriv = pCrtc->driver_private;
+ if (pCrtcPriv == NULL)
+ return;
SECPtr pSec = SECPTR (pCrtc->scrn);
if (pCrtcPriv->move_layer)
xf86CrtcPtr pCrtc = (xf86CrtcPtr)data;
SECPtr pSec = SECPTR (pCrtc->scrn);
SECCrtcPrivPtr pCrtcPriv = pCrtc->driver_private;
-
+ if (pCrtcPriv == NULL)
+ return;
XDBG_RETURN_IF_FAIL (pCrtcPriv->move_layer == FALSE);
if(pSec->ovl_drawable)
static Bool
_cursorFindRelativeDevice (xf86CrtcPtr pCrtc)
{
+ if (pCrtc == NULL)
+ {
+ return FALSE;
+ }
InputInfoPtr localDevices;
DeviceIntPtr dev;
SECCrtcPrivPtr pCrtcPriv = pCrtc->driver_private;
+ if (pCrtcPriv == NULL)
+ return FALSE;
XDBG_TRACE (MCRS, "[%p] \n", pCrtc);
{
ScrnInfoPtr pScrn = (ScrnInfoPtr) unused;
xf86CrtcPtr pCrtc = xf86CompatCrtc (pScrn);
+ if (pCrtc == NULL)
+ return;
XacePropertyAccessRec *rec = (XacePropertyAccessRec*)calldata;
PropertyPtr pProp = *rec->ppProp;
Atom name = pProp->propertyName;
_cursorRegisterBlockHandler (xf86CrtcPtr pCrtc)
{
SECCrtcPrivPtr pCrtcPriv = pCrtc->driver_private;
+ if (pCrtcPriv == NULL)
+ return;
XDBG_RETURN_IF_FAIL (pCrtcPriv->move_layer == FALSE);
_cursorUnregisterBlockHandler (xf86CrtcPtr pCrtc)
{
SECCrtcPrivPtr pCrtcPriv = pCrtc->driver_private;
+ if (pCrtcPriv == NULL)
+ return;
if (!pCrtcPriv->registered_block_handler)
return;
_cursorMove (xf86CrtcPtr pCrtc, int x, int y)
{
SECCrtcPrivPtr pCrtcPriv = pCrtc->driver_private;
+ if (pCrtcPriv == NULL)
+ return;
if (!pCrtcPriv->move_layer)
return;
_cursorInit (xf86CrtcPtr pCrtc)
{
SECCrtcPrivPtr pCrtcPriv = pCrtc->driver_private;
+ if (pCrtcPriv == NULL)
+ return;
XDBG_TRACE (MCRS, "[%p] \n", pCrtc);
_cursorDestroy (xf86CrtcPtr pCrtc)
{
SECCrtcPrivPtr pCrtcPriv = pCrtc->driver_private;
+ if (pCrtcPriv == NULL)
+ return FALSE;
XDBG_TRACE (MCRS, "[%p] \n", pCrtc);
_cursorShow (xf86CrtcPtr pCrtc)
{
SECCrtcPrivPtr pCrtcPriv = pCrtc->driver_private;
+ if (pCrtcPriv == NULL)
+ return;
SECPtr pSec = SECPTR (pCrtc->scrn);
if(!pSec->enableCursor)
_cursorHide (xf86CrtcPtr pCrtc)
{
SECCrtcPrivPtr pCrtcPriv = pCrtc->driver_private;
+ if (pCrtcPriv == NULL)
+ return;
XDBG_TRACE (MCRS, "[%p] \n", pCrtc);
{
ScrnInfoPtr pScrn = pCrtc->scrn;
SECCrtcPrivPtr pCrtcPriv = pCrtc->driver_private;
+ if (pCrtcPriv == NULL)
+ return FALSE;
if (!pCrtcPriv->cursor_show)
return FALSE;
{
SECPtr pSec = SECPTR (pCrtc->scrn);
SECCrtcPrivPtr pCrtcPriv = pCrtc->driver_private;
+ if (pCrtcPriv == NULL)
+ return FALSE;
if (pCrtcPriv->user_rotate == rotate)
return TRUE;
_cursorChangeStatus (xf86CrtcPtr pCrtc)
{
SECCrtcPrivPtr pCrtcPriv = pCrtc->driver_private;
+ if (pCrtcPriv == NULL)
+ return FALSE;
SECPtr pSec = SECPTR (pCrtc->scrn);
int new_value;
ScrnInfoPtr pScrn = pCrtc->scrn;
SECPtr pSec = SECPTR (pScrn);
SECCrtcPrivPtr pCrtcPriv = pCrtc->driver_private;
+ if (pCrtcPriv == NULL)
+ return;
int flip_backbufs = pSec->flip_bufs - 1;
int i;
_flipPixmapDeinit (xf86CrtcPtr pCrtc)
{
SECCrtcPrivPtr pCrtcPriv = pCrtc->driver_private;
+ if (pCrtcPriv == NULL)
+ return;
ScreenPtr pScreen = pCrtc->scrn->pScreen;
int i;
{
pCrtc = pXf86CrtcConfig->crtc[i];
pCrtcPriv = pCrtc->driver_private;
+ if (pCrtcPriv == NULL)
+ continue;
if (pCrtcPriv->pipe == pipe)
{
return pCrtc;
SECPtr pSec = SECPTR (pScrn);
SECFbPtr pFb = pSec->pFb;
SECCrtcPrivPtr pCrtcPriv = pCrtc->driver_private;
+ if (pCrtcPriv == NULL)
+ {
+ return TRUE;
+ }
SECModePtr pSecMode = pCrtcPriv->pSecMode;
tbm_bo bo = NULL, old_bo = NULL;
tbm_bo bo_accessibility[2] = {0,}, old_bo_accessibility[2] = {0,};
ret = secCrtcApply(pCrtc);
XDBG_GOTO_IF_FAIL (ret == TRUE, fail);
-
+#ifdef NO_CRTC_MODE
+ pSec->isCrtcOn = secCrtcCheckInUseAll(pScrn);
+#endif
/* set the default external mode */
secDisplayModeToKmode (pCrtc->scrn, &pSecMode->ext_connector_mode, pMode);
SECCrtcSetCursorPosition (xf86CrtcPtr pCrtc, int x, int y)
{
SECCrtcPrivPtr pCrtcPriv = pCrtc->driver_private;
+ if (pCrtcPriv == NULL)
+ {
+ return;
+ }
SECPtr pSec = SECPTR (pCrtc->scrn);
pCrtcPriv->cursor_pos_x = x;
{
SECCrtcPrivPtr pCrtcPriv = pCrtc->driver_private;
+ if (pCrtcPriv == NULL)
+ {
+ return;
+ }
+
XDBG_TRACE (MCRS, "[%p] cursor_show(%d)\n", pCrtc, pCrtcPriv->cursor_show);
if(pCrtcPriv->cursor_show)
{
SECCrtcPrivPtr pCrtcPriv = pCrtc->driver_private;
+ if (pCrtcPriv == NULL)
+ {
+ return;
+ }
+
XDBG_TRACE (MCRS, "[%p] cursor_show(%d)\n", pCrtc, pCrtcPriv->cursor_show);
if(!pCrtcPriv->cursor_show)
{
SECCrtcPrivPtr pCrtcPriv = pCrtc->driver_private;
- if (image == NULL)
+ if (pCrtcPriv == NULL || image == NULL)
+ {
#ifdef LATEST_XORG
return FALSE;
#else
return;
#endif
-
+ }
XDBG_TRACE (MCRS, "[%p] image(%p) \n", pCrtc, image);
if (pCrtcPriv->backup_image)
CARD16 *red, CARD16 *green, CARD16 *blue, int size)
{
SECCrtcPrivPtr pCrtcPriv = pCrtc->driver_private;
+ if (pCrtcPriv == NULL)
+ {
+ return;
+ }
SECModePtr pSecMode = pCrtcPriv->pSecMode;
drmModeCrtcSetGamma(pSecMode->fd, secCrtcID(pCrtcPriv),
SECCrtcDestroy(xf86CrtcPtr pCrtc)
{
SECCrtcPrivPtr pCrtcPriv = pCrtc->driver_private;
-
+ if (pCrtcPriv == NULL)
+ {
+ return;
+ }
DRI2FrameEventPtr event_ref=NULL, event_next=NULL;
xorg_list_for_each_entry_safe (event_ref, event_next, &pCrtcPriv->pending_flips, crtc_pending_link)
{
.gamma_set = SECCrtcGammaSet,
.destroy = SECCrtcDestroy,
};
-
+#ifdef NO_CRTC_MODE
+xf86CrtcPtr
+secCrtcDummyInit (ScrnInfoPtr pScrn)
+{
+ xf86CrtcPtr pCrtc = NULL;
+ pCrtc = xf86CrtcCreate (pScrn, &sec_crtc_funcs);
+ return pCrtc;
+}
+#endif //NO_CRTC_MODE
void
secCrtcInit (ScrnInfoPtr pScrn, SECModePtr pSecMode, int num)
{
_flipPixmapInit (pCrtc);
xorg_list_add(&(pCrtcPriv->link), &(pSecMode->crtcs));
+#ifdef NO_CRTC_MODE
+ pSecMode->num_real_crtc++;
+#endif
}
/* check the crtc is on */
{
ScrnInfoPtr pScrn = pCrtc->scrn;
SECCrtcPrivPtr pCrtcPriv = pCrtc->driver_private;
+ if (pCrtcPriv == NULL)
+ return FALSE;
SECModePtr pSecMode = pCrtcPriv->pSecMode;
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR (pCrtc->scrn);
uint32_t *output_ids;
continue;
pOutputPriv = pOutput->driver_private;
+ if (pOutputPriv == NULL)
+ {
+ continue;
+ }
/* modify the physical size of monitor */
+#if 0
if (!strcmp(pOutput->name, "LVDS1"))
+#endif
{
pOutput->mm_width = pOutputPriv->mode_output->mmWidth;
pOutput->mm_height = pOutputPriv->mode_output->mmHeight;
- pOutput->conf_monitor->mon_width = pOutputPriv->mode_output->mmWidth;
- pOutput->conf_monitor->mon_height = pOutputPriv->mode_output->mmHeight;
+ if (pOutput->conf_monitor)
+ {
+ pOutput->conf_monitor->mon_width = pOutputPriv->mode_output->mmWidth;
+ pOutput->conf_monitor->mon_height = pOutputPriv->mode_output->mmHeight;
+ }
}
output_ids[output_count] = pOutputPriv->mode_output->connector_id;
continue;
pOutputPriv = pOutput->driver_private;
+#if 1
+ memcpy (&pSecMode->main_lcd_mode, pOutputPriv->mode_output->modes, sizeof(drmModeModeInfo));
+#endif
/* TODO :: soolim :: check this out */
secOutputDpmsSet(pOutput, DPMSModeOn);
SECOutputPrivPtr pOutputPriv = pOutput->driver_private;
if (pOutput->crtc == pCrtc)
- return pOutputPriv->mode_output->connector_type;
+ {
+ if (pOutputPriv != NULL)
+ return pOutputPriv->mode_output->connector_type;
+ else
+ return DRM_MODE_CONNECTOR_Unknown;
+ }
}
return DRM_MODE_CONNECTOR_Unknown;
XDBG_RETURN_VAL_IF_FAIL (pCrtc != NULL, FALSE);
pCrtcPriv = pCrtc->driver_private;
+ if (pCrtcPriv == NULL)
+ return FALSE;
/* if isFlipping is true, return true */
if (pCrtcPriv->is_flipping)
XDBG_RETURN_VAL_IF_FAIL (pCrtc != NULL, NULL);
pCrtcPriv = pCrtc->driver_private;
+ if (pCrtcPriv == NULL)
+ return NULL;
if (xorg_list_is_empty (&pCrtcPriv->pending_flips))
return NULL;
XDBG_RETURN_VAL_IF_FAIL (pCrtc != NULL, NULL);
pCrtcPriv = pCrtc->driver_private;
+ if (pCrtcPriv == NULL)
+ return NULL;
if (xorg_list_is_empty (&pCrtcPriv->pending_flips))
return NULL;
XDBG_RETURN_IF_FAIL (pCrtc != NULL);
pCrtcPriv = pCrtc->driver_private;
+ if (pCrtcPriv == NULL)
+ return;
xorg_list_add(&(pEvent->crtc_pending_link), &(pCrtcPriv->pending_flips));
}
XDBG_RETURN_IF_FAIL (pCrtc != NULL);
pCrtcPriv = pCrtc->driver_private;
+ if (pCrtcPriv == NULL)
+ return;
if (xorg_list_is_empty (&pCrtcPriv->pending_flips))
return;
}
SECCrtcPrivPtr pCrtcPriv = pCrtc->driver_private;
+ if (pCrtcPriv == NULL)
+ return FALSE;
XDBG_RETURN_VAL_IF_FAIL(src_bo != NULL, FALSE);
XDBG_RETURN_VAL_IF_FAIL(dst_bo != NULL, FALSE);
XDBG_RETURN_VAL_IF_FAIL(pCrtc != NULL, FALSE);
pCrtcPriv = pCrtc->driver_private;
+ if (pCrtcPriv == NULL)
+ return FALSE;
XDBG_RETURN_VAL_IF_FAIL(pCrtcPriv->screen_rotate_prop_id > 0, FALSE);
pSec = SECPTR(pCrtc->scrn);
secCrtcExecAccessibility (xf86CrtcPtr pCrtc, tbm_bo src_bo, tbm_bo dst_bo)
{
SECCrtcPrivPtr pCrtcPriv = pCrtc->driver_private;
+ if (pCrtcPriv == NULL)
+ return FALSE;
Bool ret = FALSE;
CARD32 elapsed = 0;
SECPtr pSec = SECPTR(pCrtc->scrn);
ScrnInfoPtr pScrn = pCrtc->scrn;
SECCrtcPrivPtr pCrtcPriv = pCrtc->driver_private;
+ if (pCrtcPriv == NULL)
+ return FALSE;
/* accessibility and screen rotate can't be enable at the same time */
XDBG_RETURN_VAL_IF_FAIL (pCrtcPriv->screen_rotate_degree == 0, FALSE);
ScrnInfoPtr pScrn = pCrtc->scrn;
SECCrtcPrivPtr pCrtcPriv = pCrtc->driver_private;
+ if (pCrtcPriv == NULL)
+ return FALSE;
int width = pCrtc->mode.HDisplay;
int height = pCrtc->mode.VDisplay;
int degree = pCrtcPriv->screen_rotate_degree;
ScrnInfoPtr pScrn = pCrtc->scrn;
SECPtr pSec = SECPTR(pCrtc->scrn);
SECCrtcPrivPtr pCrtcPriv = pCrtc->driver_private;
+ if (pCrtcPriv == NULL)
+ return FALSE;
CARD32 elapsed[3] = {0,};
if (pCrtcPriv->screen_rotate_degree == degree)
{
SECModePtr pSecMode = SECPTR (pCrtc->scrn)->pSecMode;
SECCrtcPrivPtr pCrtcPriv = pCrtc->driver_private;
+ if (pCrtcPriv == NULL)
+ return FALSE;
int crtc_id = secCrtcID(pCrtcPriv);
int mode;
secCrtcCheckOn (xf86CrtcPtr pCrtc)
{
SECCrtcPrivPtr pCrtcPriv = pCrtc->driver_private;
+ if (pCrtcPriv == NULL)
+ return FALSE;
return pCrtcPriv->onoff;
}
pCrtcPriv = pCrtc->driver_private;
+ if (pCrtcPriv == NULL)
+ return FALSE;
+
/* there is a free flip pixmap, return false */
for (i = 0; i < pCrtcPriv->flip_backpixs.num; i++)
{
pCrtcPriv = pCrtc->driver_private;
+ if (pCrtcPriv == NULL)
+ return NULL;
+
/* check if there is free flip pixmaps */
if (secCrtcFullFreeFlipPixmap(pScrn, crtc_pipe))
{
pCrtcPriv = pCrtc->driver_private;
+ if (pCrtcPriv == NULL)
+ return;
+
/* release flip pixmap */
for (i = 0; i < pCrtcPriv->flip_backpixs.num; i++)
{
XDBG_RETURN_IF_FAIL(pCrtc != NULL);
pCrtcPriv = pCrtc->driver_private;
+ if (pCrtcPriv == NULL)
+ return;
/* release flip pixmap */
for (i = 0; i < pCrtcPriv->flip_backpixs.num; i++)
return;
pCrtcPriv = pCrtc->driver_private;
+ if (pCrtcPriv == NULL)
+ return;
conn_type = secCrtcGetConnectType (pCrtc);
xDbgLogFpsDebugCount (pCrtcPriv->pFpsDebug, conn_type);
}
+#ifdef NO_CRTC_MODE
+Bool
+secCrtcCheckInUseAll(ScrnInfoPtr pScrn)
+{
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
+ int i;
+ Bool ret = FALSE;
+ if (config == NULL)
+ return ret;
+ for (i = 0; i < config->num_crtc; i++)
+ {
+ xf86CrtcPtr pCrtc = config->crtc[i];
+ if (xf86CrtcInUse(pCrtc))
+ {
+ ret = TRUE;
+ break;
+ }
+ }
+ xf86DrvMsg (pScrn->scrnIndex, X_INFO ,
+ "%s found active CRTC\n", ret?"":"NOT");
+ return ret;
+}
+#endif //NO_CRTC_MODE
xf86CrtcPtr pCrtc;
struct xorg_list link;
} SECCrtcPrivRec, *SECCrtcPrivPtr;
-
+#ifdef NO_CRTC_MODE
+xf86CrtcPtr secCrtcDummyInit (ScrnInfoPtr pScrn);
+Bool secCrtcCheckInUseAll(ScrnInfoPtr pScrn);
+#endif
void secCrtcInit (ScrnInfoPtr pScrn, SECModePtr pSecMode, int num);
Bool secCrtcOn (xf86CrtcPtr pCrtc);
Bool secCrtcApply (xf86CrtcPtr pCrtc);
#include "sec_converter.h"
#include "sec_util.h"
#include "sec_xberc.h"
-
+#include <xf86RandR12.h>
#include "common.h"
static Bool SECCrtcConfigResize(ScrnInfoPtr pScrn, int width, int height);
{
xf86OutputPtr pOutput = pXf86CrtcConfig->output[i];
SECOutputPrivPtr pOutputPriv = pOutput->driver_private;
+ if (!pOutputPriv)
+ continue;
if (pOutputPriv->mode_output->connector_type == DRM_MODE_CONNECTOR_LVDS ||
pOutputPriv->mode_output->connector_type == DRM_MODE_CONNECTOR_Unknown)
{
return 1;
}
}
-
+ if (pSecMode->main_lcd_mode.hdisplay == 0 ||
+ pSecMode->main_lcd_mode.vdisplay == 0)
+ {
+ pSecMode->main_lcd_mode.hdisplay = 640;
+ pSecMode->main_lcd_mode.vdisplay = 480;
+ return 1;
+ }
return -1;
}
pScrn->virtualX,
pScrn->virtualY,
width, height);
-
+#ifdef NO_CRTC_MODE
+ pSec->isCrtcOn = secCrtcCheckInUseAll(pScrn);
+#else
if (pScrn->virtualX == width &&
pScrn->virtualY == height)
{
return TRUE;
}
-
+#endif
secFbResize(pSec->pFb, width, height);
/* set the new size of pScrn */
pScrn->virtualX = width;
pScrn->virtualY = height;
+ pScrn->displayWidth = width;
secExaScreenSetScrnPixmap (pScreen);
secOutputDrmUpdate (pScrn);
for (i = 0; i < pSecMode->plane_res->count_planes; i++)
secPlaneInit (pScrn, pSecMode, i);
-
+#ifdef NO_CRTC_MODE
+ if (pSecMode->num_real_crtc == 0 ||
+ pSecMode->num_real_output == 0)
+ {
+ secOutputDummyInit(pScrn, pSecMode, FALSE);
+ }
+#endif //NO_CRTC_MODE
_secSetMainMode (pScrn, pSecMode);
+ /* virtaul x and virtual y of the screen is ones from main lcd mode */
+ pScrn->virtualX = pSecMode->main_lcd_mode.hdisplay;
+ pScrn->virtualY = pSecMode->main_lcd_mode.vdisplay;
xf86InitialConfiguration (pScrn, TRUE);
/* soolim::
/* mode->rotate_fb_id should have been destroyed already */
+#ifdef NO_CRTC_MODE
+ if (pSecMode->num_dummy_output > 0)
+ {
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+ int i;
+ for (i = 0; i < xf86_config->num_crtc; i++)
+ {
+ xf86CrtcPtr pCrtc = xf86_config->crtc[i];
+ xf86CrtcDestroy (pCrtc);
+ }
+
+ for (i = 0; i < xf86_config->num_output; i++)
+ {
+ xf86OutputPtr pOutput = xf86_config->output[i];
+ xf86OutputDestroy(pOutput);
+ }
+ }
+#endif //NO_CRTC_MODE
+
free (pSecMode);
pSec->pSecMode = NULL;
}
int secModeGetCrtcPipe (xf86CrtcPtr pCrtc)
{
SECCrtcPrivPtr pCrtcPriv = pCrtc->driver_private;
+ if (pCrtcPriv == NULL)
+ return -1;
return pCrtcPriv->pipe;
}
{
SECPtr pSec = SECPTR (pScrn);
SECModePtr pSecMode = pSec->pSecMode;
-
+#ifdef NO_CRTC_MODE
+ return TRUE;
+#endif
if (pSecMode->set_mode == set_mode)
{
XDBG_INFO (MDISP, "set_mode(%d) is already set\n", set_mode);
SECModePtr pSecMode = pSec->pSecMode;
/* if lcd is off, return true with msc = 0 */
+#ifdef NO_CRTC_MODE
+ if (pSec->isCrtcOn == FALSE)
+ {
+ *ust = 0;
+ *msc = 0;
+ return TRUE;
+ }
+ else
+#endif //NO_CRTC_MODE
if (pSec->isLcdOff)
{
*ust = 0;
Bool ret = FALSE;
SECPageFlipPtr pPageFlip = NULL;
+#ifdef NO_CRTC_MODE
+ if (pCrtc == NULL)
+ return FALSE;
+#else
XDBG_RETURN_VAL_IF_FAIL (pCrtc != NULL, FALSE);
-
+#endif
pCrtcPriv = pCrtc->driver_private;
+#ifdef NO_CRTC_MODE
+ if (pCrtcPriv == NULL)
+ return TRUE;
+#else
XDBG_RETURN_VAL_IF_FAIL (pCrtcPriv != NULL, FALSE);
+#endif
bo = pCrtcPriv->front_bo;
return ret;
}
+#ifdef NO_CRTC_MODE
+Bool
+secDisplayChangeMode (ScrnInfoPtr pScrn)
+{
+ SECPtr pSec = SECPTR(pScrn);
+ SECModePtr pSecMode = pSec->pSecMode;
+ xf86CrtcPtr pCrtc = NULL;
+ xf86OutputPtr pOutput = NULL;
+ int temp = 99, i = 0;
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
+ for (i = 0; i < config->num_crtc; i++)
+ {
+ if (config->crtc[i]->active == TRUE)
+ {
+ /* Nothing to do */
+ return TRUE;
+ }
+ }
+ SECOutputPrivPtr output_ref, output_next;
+/* Priority LVDS > HDMI > Virtual */
+ xorg_list_for_each_entry_safe (output_ref, output_next, &pSecMode->outputs, link)
+ {
+ if (output_ref->pOutput->crtc == NULL)
+ continue;
+ if (output_ref->mode_output == NULL)
+ continue;
+ if (output_ref->mode_output->connector_type == DRM_MODE_CONNECTOR_Unknown)
+ continue;
+ if (output_ref->mode_output->connector_type < temp)
+ {
+ pOutput = output_ref->pOutput;
+ pCrtc = output_ref->pOutput->crtc;
+ temp = (int) output_ref->mode_output->connector_type;
+ }
+ }
+
+ if (pCrtc != NULL && pOutput != NULL && pCrtc->active == FALSE)
+ {
+ DisplayModePtr max_mode = xf86CVTMode( 4096, 4096, 60, 0, 0);
+ DisplayModePtr mode =
+ xf86OutputFindClosestMode(pOutput, max_mode);
+ if (mode == NULL)
+ {
+ XDBG_ERROR(MDISP,
+ "Can't find display mode for output: %s\n", pOutput->name);
+ if (max_mode)
+ free(max_mode);
+ return FALSE;
+ }
+ if (!RRScreenSizeSet(pScrn->pScreen,
+ mode->HDisplay, mode->VDisplay,
+ pOutput->mm_width, pOutput->mm_height))
+ {
+ XDBG_ERROR(MDISP,
+ "Can't setup screen size H:%d V:%d for output: %s\n", mode->HDisplay, mode->VDisplay);
+ if (max_mode)
+ free(max_mode);
+ return FALSE;
+ }
+ if (!xf86CrtcSetModeTransform(pCrtc, mode, RR_Rotate_0, NULL, 0, 0))
+ {
+ XDBG_ERROR(MDISP,
+ "Can't transform Crtc to mode: %s\n", pCrtc, mode->name);
+ if (max_mode)
+ free(max_mode);
+ RRScreenSizeSet(pScrn->pScreen, 640, 480, 0, 0);
+ return FALSE;
+ }
+ if (max_mode)
+ free(max_mode);
+ pSec->enableCursor = TRUE;
+ secCrtcCursorEnable (pScrn, TRUE);
+// xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
+// for (temp = 0; temp < config->num_output; temp++)
+// {
+// if (config->output[temp] == pOutput)
+// {
+// config->compat_output = temp;
+// break;
+// }
+// }
+ xf86SetScrnInfoModes(pScrn);
+ xf86RandR12TellChanged(pScrn->pScreen);
+ }
+
+ if (pSec->isCrtcOn == FALSE)
+ {
+ pSec->enableCursor = FALSE;
+ secCrtcCursorEnable (pScrn, FALSE);
+ }
+
+ if (pCrtc == NULL)
+ {
+ RRScreenSizeSet(pScrn->pScreen, 640, 480, 0, 0);
+ xf86SetScrnInfoModes(pScrn);
+ xf86RandR12TellChanged(pScrn->pScreen);
+ }
+
+ return TRUE;
+}
+#endif
struct xorg_list outputs;
struct xorg_list crtcs;
struct xorg_list planes;
-
+#ifdef NO_CRTC_MODE
+ int num_dummy_output;
+ int num_real_output;
+ int num_real_crtc;
+#endif
SECDisplaySetMode set_mode;
SECDisplayConnMode conn_mode;
int rotate;
int secDisplayCrtcPipe (ScrnInfoPtr pScrn, int crtc_id);
Bool secDisplayUpdateRequest(ScrnInfoPtr pScrn);
-
+#ifdef NO_CRTC_MODE
+Bool secDisplayChangeMode (ScrnInfoPtr pScrn);
+#endif
#endif /* __SEC_DISPLAY_H__ */
SECPtr pSec = SECPTR (layer->pScrn);
/* if lcd is off, do not request vblank information */
+#ifdef NO_CRTC_MODE
+ if (pSec->isCrtcOn == FALSE)
+ return;
+ else
+#endif //NO_CRTC_MODE
if (pSec->isLcdOff)
return;
{
xf86CrtcPtr pCrtc = pCrtcConfig->crtc[c];
SECCrtcPrivPtr pTemp = pCrtc->driver_private;
+ if (pTemp == NULL)
+ continue;
if (pTemp->mode_crtc && pTemp->mode_crtc->crtc_id == layer->crtc_id)
{
pCrtcPriv = pTemp;
xserver-xorg-video-exynos
Copyright 2011 Samsung Electronics co., Ltd. All Rights Reserved.
+Copyright 2013 Intel Corporation
Contact: SooChan Lim <sc1.lim@samsung.com>
_secOutputAttachEdid(xf86OutputPtr pOutput)
{
SECOutputPrivPtr pOutputPriv = pOutput->driver_private;
+ if (pOutputPriv == NULL)
+ {
+ return;
+ }
drmModeConnectorPtr koutput = pOutputPriv->mode_output;
SECModePtr pSecMode = pOutputPriv->pSecMode;
drmModePropertyBlobPtr edid_blob = NULL;
}
static xf86OutputStatus
-SECOutputDetect(xf86OutputPtr output)
+SECOutputDetect(xf86OutputPtr pOutput)
{
/* go to the hw and retrieve a new output struct */
- SECOutputPrivPtr pOutputPriv = output->driver_private;
+ SECOutputPrivPtr pOutputPriv = pOutput->driver_private;
+
+ if (pOutputPriv == NULL)
+ {
+#ifdef NO_CRTC_MODE
+ if (pOutput->randr_output && pOutput->randr_output->numUserModes)
+ {
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pOutput->scrn);
+
+ if (xf86_config->output[xf86_config->num_output-1] == pOutput)
+ {
+ SECPtr pSec = (SECPtr) pOutput->scrn->driverPrivate;
+ secOutputDummyInit(pOutput->scrn, pSec->pSecMode, TRUE);
+ }
+
+ return XF86OutputStatusConnected;
+ }
+#endif //NO_CRTC_MODE
+ return XF86OutputStatusDisconnected;
+ }
+
SECModePtr pSecMode = pOutputPriv->pSecMode;
xf86OutputStatus status;
// char *conn_str[] = {"connected", "disconnected", "unknow"};
case DRM_MODE_DISCONNECTED:
status = XF86OutputStatusDisconnected;
/* unset write-back clone */
- secPropUnSetDisplayMode (output);
+ secPropUnSetDisplayMode (pOutput);
break;
default:
case DRM_MODE_UNKNOWNCONNECTION:
SECOutputModeValid(xf86OutputPtr pOutput, DisplayModePtr pModes)
{
SECOutputPrivPtr pOutputPriv = pOutput->driver_private;
+ if (pOutputPriv == NULL)
+ {
+#ifdef NO_CRTC_MODE
+ if (pModes->type & M_T_DEFAULT)
+ return MODE_BAD;
+ return MODE_OK;
+#else
+ return MODE_ERROR;
+#endif //NO_CRTC_MODE
+ }
drmModeConnectorPtr koutput = pOutputPriv->mode_output;
int i;
/* driver want to remain available modes which is same as mode
supported from drmmode */
+#if NO_CRTC_MODE
if (pOutputPriv->mode_output->connector_type == DRM_MODE_CONNECTOR_LVDS)
+#endif
{
for (i = 0; i < koutput->count_modes; i++)
{
static DisplayModePtr
SECOutputGetModes(xf86OutputPtr pOutput)
{
+ DisplayModePtr Modes = NULL;
SECOutputPrivPtr pOutputPriv = pOutput->driver_private;
+ if (pOutputPriv == NULL)
+ {
+#ifdef NO_CRTC_MODE
+ Modes = xf86ModesAdd(Modes, xf86CVTMode(1024,
+ 768,
+ 60, 0, 0));
+#endif
+ return Modes;
+ }
+
drmModeConnectorPtr koutput = pOutputPriv->mode_output;
- DisplayModePtr Modes = NULL;
int i;
SECPtr pSec = SECPTR (pOutput->scrn);
DisplayModePtr Mode;
SECOutputDestory(xf86OutputPtr pOutput)
{
SECOutputPrivPtr pOutputPriv = pOutput->driver_private;
+ if (pOutputPriv == NULL)
+ {
+ return;
+ }
SECPtr pSec = SECPTR (pOutput->scrn);
int i;
SECOutputDpms(xf86OutputPtr pOutput, int dpms)
{
SECOutputPrivPtr pOutputPriv = pOutput->driver_private;
+ if (pOutputPriv == NULL)
+ return;
drmModeConnectorPtr koutput = pOutputPriv->mode_output;
SECModePtr pSecMode = pOutputPriv->pSecMode;
SECPtr pSec = SECPTR (pOutput->scrn);
SECOutputCreateReaources(xf86OutputPtr pOutput)
{
SECOutputPrivPtr pOutputPriv = pOutput->driver_private;
+ if (pOutputPriv == NULL)
+ return;
drmModeConnectorPtr mode_output = pOutputPriv->mode_output;
SECModePtr pSecMode = pOutputPriv->pSecMode;
int i, j, err;
RRPropertyValuePtr value)
{
SECOutputPrivPtr pOutputPriv = output->driver_private;
+ if (pOutputPriv == NULL)
+ return TRUE;
SECModePtr pSecMode = pOutputPriv->pSecMode;
int i;
*/
/* set the hidden properties : features for sec debugging*/
/* TODO : xberc can works on only LVDS????? */
- if (pOutputPriv->mode_output->connector_type == DRM_MODE_CONNECTOR_LVDS)
+#ifdef NO_CRTC_MODE
+ if ((pOutputPriv->mode_output->connector_type == DRM_MODE_CONNECTOR_HDMIA) || (pOutputPriv->mode_output->connector_type == DRM_MODE_CONNECTOR_VIRTUAL))
+#else
+ if (pOutputPriv->mode_output->connector_type == DRM_MODE_CONNECTOR_LVDS)
+#endif
{
if (secPropSetLvdsFunc (output, property, value))
return TRUE;
return TRUE;
}
/* set the hidden properties : features for driver specific funtions */
+#ifndef NO_CRTC_MODE
if (pOutputPriv->mode_output->connector_type == DRM_MODE_CONNECTOR_HDMIA ||
pOutputPriv->mode_output->connector_type == DRM_MODE_CONNECTOR_HDMIB ||
pOutputPriv->mode_output->connector_type == DRM_MODE_CONNECTOR_VIRTUAL)
if (secPropSetDisplayMode(output, property, value))
return TRUE;
}
-
+#endif
return TRUE;
}
Bool
secOutputDrmUpdate (ScrnInfoPtr pScrn)
{
- SECModePtr pSecMode = (SECModePtr) SECPTR (pScrn)->pSecMode;
+ SECPtr pSec = SECPTR (pScrn);
+ SECModePtr pSecMode = pSec->pSecMode;
Bool ret = TRUE;
int i;
for (i = 0; i < pSecMode->mode_res->count_connectors; i++)
{
+#ifdef NO_CRTC_MODE
+ ret = TRUE;
+#endif
SECOutputPrivPtr pOutputPriv = NULL;
SECOutputPrivPtr pCur, pNext;
drmModeConnectorPtr koutput;
if (!pOutputPriv)
{
+#ifdef NO_CRTC_MODE
+ continue;
+#else
ret = FALSE;
break;
+#endif
}
-
+#ifdef NO_CRTC_MODE
+ pOutputPriv->pOutput->crtc = NULL;
+#endif
koutput = drmModeGetConnector (pSecMode->fd,
pSecMode->mode_res->connectors[i]);
if (!koutput)
{
+#ifdef NO_CRTC_MODE
+ continue;
+#else
ret = FALSE;
break;
+#endif
}
kencoder = drmModeGetEncoder (pSecMode->fd, koutput->encoders[0]);
if (!kencoder)
{
drmModeFreeConnector (koutput);
+#ifdef NO_CRTC_MODE
+ continue;
+#else
ret = FALSE;
break;
+#endif
}
if (pOutputPriv->mode_output)
pOutputPriv->mode_encoder = NULL;
}
pOutputPriv->mode_encoder = kencoder;
-
+#ifdef NO_CRTC_MODE
+ SECCrtcPrivPtr crtc_ref=NULL, crtc_next=NULL;
+ xorg_list_for_each_entry_safe (crtc_ref, crtc_next, &pSecMode->crtcs, link)
+ {
+ if (pOutputPriv->mode_encoder->crtc_id == crtc_ref->mode_crtc->crtc_id)
+ {
+ pOutputPriv->pOutput->crtc = crtc_ref->pCrtc;
+ }
+ }
+#endif
XDBG_INFO (MSEC, "drm update : connect(%d, type:%d, status:%s) encoder(%d) crtc(%d).\n",
pSecMode->mode_res->connectors[i], koutput->connector_type,
conn_str[pOutputPriv->mode_output->connection-1],
kencoder->encoder_id, kencoder->crtc_id);
-#if 0
+#ifdef NO_CRTC_MODE
/* Does these need to update? */
- pOutput->mm_width = koutput->mmWidth;
- pOutput->mm_height = koutput->mmHeight;
-
- pOutput->possible_crtcs = kencoder->possible_crtcs;
- pOutput->possible_clones = kencoder->possible_clones;
+ pOutputPriv->pOutput->mm_width = koutput->mmWidth;
+ pOutputPriv->pOutput->mm_height = koutput->mmHeight;
+ pOutputPriv->pOutput->possible_crtcs = kencoder->possible_crtcs;
+ pOutputPriv->pOutput->possible_clones = kencoder->possible_clones;
#endif
}
-
+#ifdef NO_CRTC_MODE
+ SECCrtcPrivPtr crtc_ref=NULL, crtc_next=NULL;
+ xorg_list_for_each_entry_safe (crtc_ref, crtc_next, &pSecMode->crtcs, link)
+ {
+ crtc_ref->pCrtc->enabled = xf86CrtcInUse(crtc_ref->pCrtc);
+ }
+ xf86DisableUnusedFunctions(pScrn);
+ pSec->isCrtcOn = secCrtcCheckInUseAll(pScrn);
+#endif
if (!ret)
xf86DrvMsg (pScrn->scrnIndex, X_ERROR, "drm(output) update error. (%s)\n", strerror (errno));
-
return ret;
}
+#ifdef NO_CRTC_MODE
+Bool
+secOutputDummyInit (ScrnInfoPtr pScrn, SECModePtr pSecMode, Bool late)
+{
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+ xf86OutputPtr pOutput;
+ xf86CrtcPtr pCrtc;
+ RROutputPtr clones[32];
+ RRCrtcPtr crtcs[32];
+ char buf[80];
+ int i, len;
+
+ if (pSecMode->num_dummy_output >= 32)
+ return FALSE;
+
+ XDBG_DEBUG(MDISP,"(late=%d, num_dummy=%d)\n", late, pSecMode->num_dummy_output+1);
+
+ len = sprintf(buf, "DUMMY%d", pSecMode->num_dummy_output+1);
+ pOutput = xf86OutputCreate(pScrn, &sec_output_funcs, buf);
+ if (!pOutput)
+ {
+ return FALSE;
+ }
+
+ pCrtc = secCrtcDummyInit(pScrn);
+
+ if (pCrtc == NULL)
+ {
+ xf86OutputDestroy(pOutput);
+ return FALSE;
+ }
+
+ pOutput->mm_width = 0;
+ pOutput->mm_height = 0;
+ pOutput->interlaceAllowed = FALSE;
+ pOutput->subpixel_order = SubPixelNone;
+
+ pOutput->possible_crtcs = ~((1 << pSecMode->num_real_crtc) - 1);
+ pOutput->possible_clones = ~((1 << pSecMode->num_real_output) - 1);
+
+ if (late) {
+ ScreenPtr pScreen = xf86ScrnToScreen(pScrn);
+ pCrtc->randr_crtc = RRCrtcCreate(pScreen, pCrtc);
+ pOutput->randr_output = RROutputCreate(pScreen, buf, len, pOutput);
+ if (pCrtc->randr_crtc == NULL || pOutput->randr_output == NULL)
+ {
+ xf86OutputDestroy(pOutput);
+ xf86CrtcDestroy(pCrtc);
+ return FALSE;
+ }
+ RRPostPendingProperties(pOutput->randr_output);
+
+ for (i = pSecMode->num_real_output; i < xf86_config->num_output; i++)
+ clones[i - pSecMode->num_real_output] = xf86_config->output[i]->randr_output;
+ XDBG_RETURN_VAL_IF_FAIL(i - pSecMode->num_real_output == pSecMode->num_dummy_output + 1, FALSE);
+
+ for (i = pSecMode->num_real_crtc; i < xf86_config->num_crtc; i++)
+ crtcs[i - pSecMode->num_real_crtc] = xf86_config->crtc[i]->randr_crtc;
+ XDBG_RETURN_VAL_IF_FAIL(i - pSecMode->num_real_crtc == pSecMode->num_dummy_output + 1, FALSE);
+
+ for (i = pSecMode->num_real_output; i < xf86_config->num_output; i++)
+ {
+ RROutputPtr rr_output = xf86_config->output[i]->randr_output;
+
+ if (!RROutputSetCrtcs(rr_output, crtcs, pSecMode->num_dummy_output + 1) ||
+ !RROutputSetClones(rr_output, clones, pSecMode->num_dummy_output + 1))
+ goto err;
+ }
+
+ RRCrtcSetRotations(pCrtc->randr_crtc,
+ RR_Rotate_All | RR_Reflect_All);
+ }
+
+ pSecMode->num_dummy_output++;
+ return TRUE;
+
+err:
+ for (i = 0; i < xf86_config->num_output; i++)
+ {
+ pOutput = xf86_config->output[i];
+ if (pOutput->driver_private)
+ continue;
+
+ xf86OutputDestroy(pOutput);
+ }
+
+ for (i = 0; i < xf86_config->num_crtc; i++)
+ {
+ pCrtc = xf86_config->crtc[i];
+ if (pCrtc->driver_private)
+ continue;
+ xf86CrtcDestroy(pCrtc);
+ }
+ pSecMode->num_dummy_output = -1;
+ return FALSE;
+}
+#endif //NO_CRTC_MODE
void
secOutputInit (ScrnInfoPtr pScrn, SECModePtr pSecMode, int num)
{
pOutputPriv->pOutput = pOutput;
/* TODO : soolim : management crtc privates */
xorg_list_add(&pOutputPriv->link, &pSecMode->outputs);
+#ifdef NO_CRTC_MODE
+ ++(pSecMode->num_real_output);
+#endif
}
int
secOutputDpmsStatus(xf86OutputPtr pOutput)
{
SECOutputPrivPtr pOutputPriv = pOutput->driver_private;
+ if (pOutputPriv == NULL)
+ return 0;
return pOutputPriv->dpms_mode;
}
return pCur;
}
}
-
+#ifndef NO_CRTC_MODE
XDBG_ERROR (MSEC, "no output for connect_type(%d) \n", connect_type);
-
+#endif
return NULL;
}
#include "sec_display.h"
+#ifndef RR_Rotate_All
+#define RR_Rotate_All (RR_Rotate_0|RR_Rotate_90|RR_Rotate_180|RR_Rotate_270)
+#endif //RR_Rotate_All
+#ifndef RR_Reflect_All
+#define RR_Reflect_All (RR_Reflect_X|RR_Reflect_Y)
+#endif //RR_Reflect_All
+
typedef struct _secOutputPriv
{
SECModePtr pSecMode;
xf86OutputPtr pOutput;
struct xorg_list link;
} SECOutputPrivRec, *SECOutputPrivPtr;
-
-
+#ifdef NO_CRTC_MODE
+Bool secOutputDummyInit (ScrnInfoPtr pScrn, SECModePtr pSecMode, Bool late);
+#endif
void secOutputInit (ScrnInfoPtr pScrn, SECModePtr pSecMode, int num);
int secOutputDpmsStatus (xf86OutputPtr pOutput);
void secOutputDpmsSet (xf86OutputPtr pOutput, int mode);
int *new_src_x, int *new_src_w,
int *new_dst_x, int *new_dst_w)
{
- SECOutputPrivPtr pOutputPriv = secOutputGetPrivateForConnType (pScrn, DRM_MODE_CONNECTOR_LVDS);
+#ifdef NO_CRTC_MODE
+ SECOutputPrivPtr pOutputPriv = NULL;
+ int i = 1;
+ while (i <= DRM_MODE_CONNECTOR_VIRTUAL)
+ {
+ pOutputPriv = secOutputGetPrivateForConnType (pScrn, i++);
+ if (pOutputPriv != NULL && pOutputPriv->pOutput->crtc != NULL)
+ break;
+ pOutputPriv = NULL;
+ }
+ if (pOutputPriv == NULL)
+ return FALSE;
+ int max = pScrn->virtualX;
+#else
SECModePtr pSecMode = (SECModePtr) SECPTR (pScrn)->pSecMode;
+ SECOutputPrivPtr pOutputPriv = secOutputGetPrivateForConnType (pScrn, DRM_MODE_CONNECTOR_LVDS);
int max = pSecMode->main_lcd_mode.hdisplay;
+#endif
int start, end, diff;
Bool virtual_screen;
#include "sec_xberc.h"
#include "sec_util.h"
#include "sec_wb.h"
+#include "sec_crtc.h"
#include <tbm_bufmgr.h>
#include "fimg2d.h"
+#include "sec_output.h"
#define OPTION_FLIP_BUFFERS 0
else
xf86DrvMsg (pScrn->scrnIndex, X_CONFIG
, "G2D is disabled\n");
-
+#ifdef NO_CRTC_MODE
+ /*** Temporary disable G2D acceleration for using PIXMAN ***/
+ pSec->is_accel_2d = FALSE;
+#endif
return TRUE;
}
hotplug && atoi(hotplug) == 1)
{
XDBG_INFO(MSEC, "SEC-UDEV: HotPlug\n");
- RRGetInfo (screenInfo.screens[pScrn->scrnIndex], TRUE);
+ RRGetInfo (xf86ScrnToScreen(pScrn), TRUE);
+#ifdef NO_CRTC_MODE
+ secOutputDrmUpdate (pScrn);
+ secDisplayChangeMode(pScrn);
+#endif
}
udev_device_unref(dev);
"fail to set the gamma\n");
goto bail1;
}
-
+#ifdef NO_CRTC_MODE
+ if (pScrn->modes == NULL)
+ {
+ pScrn->modes = xf86ModesAdd(pScrn->modes,
+ xf86CVTMode(pScrn->virtualX,
+ pScrn->virtualY,
+ 60, 0, 0));
+ }
+#endif
pScrn->currentMode = pScrn->modes;
+
pScrn->displayWidth = pScrn->virtualX;
xf86PrintModes (pScrn); /* just print the current mode */
#if USE_XDBG
xDbgLogPListInit (pScreen);
#endif
-
+#ifdef NO_CRTC_MODE
+ pSec->isCrtcOn = secCrtcCheckInUseAll(pScrn);
+#endif
XDBG_KLOG(MSEC, "Init Screen\n");
return TRUE;
}
SECVideoPrivPtr pVideoPriv;
Bool isLcdOff; /* lvds connector on/off status */
-
+#ifdef NO_CRTC_MODE
+ Bool isCrtcOn; /* Global crtc status */
+#endif
/* screen wrapper functions */
CloseScreenProcPtr CloseScreen;
CreateScreenResourcesProcPtr CreateScreenResources;
SECPortPrivPtr pCur = NULL, pNext = NULL;
SECPortPrivPtr pAnother = NULL;
int i = 0;
-
+#ifdef NO_CRTC_MODE
+/* Sorry This is temporary part */
+ secCrtcCursorEnable (pPort->pScrn, FALSE);
+ secLayerSetPos (pPort->layer, LAYER_UPPER);
+ return;
+/* ************************* */
+#endif
xorg_list_for_each_entry_safe (pCur, pNext, &layer_owners, link)
{
if (pCur == pPort)
DrawablePtr pDraw)
{
SECPtr pSec = SECPTR (pScrn);
+#ifdef NO_CRTC_MODE
+ if (pSec->isCrtcOn == FALSE)
+ {
+ XDBG_WARNING (MVDO, "XV PutImage Disabled (No active CRTCs)\n");
+ return BadRequest;
+ }
+#endif
SECModePtr pSecMode = (SECModePtr)SECPTR (pScrn)->pSecMode;
SECVideoPrivPtr pVideo = SECPTR (pScrn)->pVideoPriv;
SECPortPrivPtr pPort = (SECPortPrivPtr) data;
{
int i;
- if (!pPort->outbuf[0])
+ if (!pPort->outbuf)
{
XDBG_RETURN_VAL_IF_FAIL (pPort->pDraw != NULL, NULL);
_secVirtualVideoEnsureOutBuffers (pPort->pScrn, pPort, pPort->id,
}
static int
-_secVirtualVideoCompositeExtLayers (SECPortPrivPtr pPort)
+_secVirtualVideoCompositeExtLayers (SECPortPrivPtr pPort, int connector_type)
{
SECVideoBuf *dst_buf = NULL;
SECLayer *lower_layer = NULL;
int index;
Bool comp = FALSE;
+ if (!_secVirtualVideoEnsureOutBuffers (pPort->pScrn, pPort, pPort->id, pPort->pDraw->width, pPort->pDraw->height))
+ return FALSE;
+
index = _secVirtualVideoGetOutBufferIndex (pPort);
if (index < 0)
{
/* before compositing, flush all */
secUtilCacheFlush (pPort->pScrn);
- ui_buf = _secVirtualVideoGetUIBuffer (pPort, DRM_MODE_CONNECTOR_VIRTUAL);
+ comp = TRUE;//if set to FALSE capture will be black. something with layers?
+
+ ui_buf = _secVirtualVideoGetUIBuffer (pPort, connector_type); //Need to choose active connector DRM_MODE_CONNECTOR_VIRTUAL
if (ui_buf)
{
XDBG_DEBUG (MVA, "ui : %c%c%c%c %dx%d (%d,%d %dx%d) => dst : %c%c%c%c %dx%d (%d,%d %dx%d)\n",
return FALSE;
}
- comp = TRUE;
+// comp = TRUE;
}
upper_layer = secLayerFind (LAYER_OUTPUT_EXT, LAYER_UPPER);
}
static int
-_secVirtualVideoPutStill (SECPortPrivPtr pPort)
+_secVirtualVideoPutStill (SECPortPrivPtr pPort, int connector_type)
{
SECModePtr pSecMode = (SECModePtr)SECPTR (pPort->pScrn)->pSecMode;
SECVideoBuf *pix_buf = NULL;
pPort->retire_timer = NULL;
}
- comp = FALSE;
+ comp = TRUE;//if set to FALSE capture will be black. something with layers?
pix_buf = _secVirtualVideoGetDrawableBuffer (pPort);
XDBG_GOTO_IF_FAIL (pix_buf != NULL, done_still);
- ui_buf = _secVirtualVideoGetUIBuffer (pPort, DRM_MODE_CONNECTOR_LVDS);
+ ui_buf = _secVirtualVideoGetUIBuffer (pPort, connector_type);
XDBG_GOTO_IF_FAIL (ui_buf != NULL, done_still);
tbm_bo_map (pix_buf->bo[0], TBM_DEVICE_2D, TBM_OPTION_WRITE);
}
static int
-_secVirtualVideoPutExt (SECPortPrivPtr pPort)
+_secVirtualVideoPutExt (SECPortPrivPtr pPort, int active_connector)
{
- if (_secVirtualVideoCompositeExtLayers (pPort))
+ if (_secVirtualVideoCompositeExtLayers (pPort, active_connector))
return Success;
return BadRequest;
pPort->need_damage = TRUE;
+ /*find what connector is active*/
+ int active_connector = -1, i = 0; //DRM_MODE_CONNECTOR_HDMIA
+ xf86CrtcConfigPtr pXf86CrtcConfig;
+ xf86OutputPtr pOutput;
+
+ pXf86CrtcConfig = XF86_CRTC_CONFIG_PTR (pPort->pScrn);
+
+ for ( i = 0; i < pXf86CrtcConfig->num_output; i++)
+ {
+ if (pXf86CrtcConfig->output[i]->status == XF86OutputStatusConnected)
+ {
+ pOutput = pXf86CrtcConfig->output[i];
+ if (!strcmp(pOutput->name, "HDMI1"))
+ {
+ active_connector = DRM_MODE_CONNECTOR_HDMIA;
+ } else if (!strcmp(pOutput->name, "Virtual1"))
+ {
+ active_connector = DRM_MODE_CONNECTOR_VIRTUAL;
+ }
+
+ }
+ }
+ XDBG_RETURN_VAL_IF_FAIL (active_connector != -1, BadRequest);
+
if (pPort->capture == CAPTURE_MODE_STILL && pPort->display == DISPLAY_LCD)
{
XDBG_DEBUG (MVA, "still mode.\n");
- if (1)
- ret = _secVirtualVideoPutStill (pPort);
- else
- /* camera buffer can't be mapped. we should use WB to capture screen */
- ret = _secVirtualVideoPutWB (pPort);
-
+ ret = _secVirtualVideoPutStill (pPort, active_connector);
XDBG_GOTO_IF_FAIL (ret == Success, put_still_fail);
}
else if (pPort->capture == CAPTURE_MODE_STREAM && pPort->display == DISPLAY_LCD)
ret = BadRequest;
goto put_still_fail;
}
-
- ret = _secVirtualVideoPutWB (pPort);
+//#ifndef SNEAKERS
+ if (0)
+ ret = _secVirtualVideoPutWB (pPort);
+ else
+ ret = _secVirtualVideoPutExt (pPort, active_connector);
if (ret != Success)
goto put_still_fail;
}
goto put_still_fail;
}
- ret = _secVirtualVideoPutExt (pPort);
+ ret = _secVirtualVideoPutExt (pPort, active_connector);
if (ret != Success)
goto put_still_fail;
break;